Yue Posted December 19, 2019 Share Posted December 19, 2019 Luxology imageSynth v2.0.zip I share this tool, to remove the edges of the textures. 1 Quote Link to comment Share on other sites More sharing options...
reepblue Posted December 19, 2019 Share Posted December 19, 2019 I still want to try this with my hardware. I'll let you know when I do. 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
havenphillip Posted December 23, 2019 Author Share Posted December 23, 2019 Here's a lua script to attach to stuff for the shader: Script.diffuse = "" --path "Diffuse Map" "Texture File (*tex):tex|Texture" Script.normal = "" --path "Normal Map" "Texture File (*tex):tex|Texture" Script.specular = "" --path "Specular Map" "Texture File (*tex):tex|Texture" Script.height = "" --path "Height Map" "Texture File (*tex):tex|Texture" Script.diffuseColor = Vec4(0.4,0.4,0.5,1.0) -- color "Diffuse Hue" Script.brightness = 2.0 -- float "Brightness" Script.specIntensity = 3.0 -- float "Specular Intensity" Script.parallaxSteps = 10 -- float "Parallax Steps" Script.parallaxDepth = 0.03 -- float "Parallax Depth" Script.parallaxRounding = 0.2 -- float "Parallax Rounding" Script.texSize = 1.5 -- float "Texture Size" function Script:Start() self.shader = Shader:Load("Parallax/parallax_economy.shader") --self.shader = Shader:Load("Parallax/parallax.shader") --surface = self.entity:GetSurface(0) -- for models surface = self.entity:GetFace(0) --for brushes mat = surface:GetMaterial() self.entity:SetMaterial(mat) mat:SetTexture(self.diffuse,0) mat:SetTexture(self.normal,1) mat:SetTexture(self.specular,2) mat:SetTexture(self.height,3) mat:SetShader(self.shader) self.shader:SetVec4("diffuse_hue", self.diffuseColor) self.shader:SetFloat("diffuse_brightness", self.brightness) self.shader:SetFloat("specular_intensity", self.specIntensity) self.shader:SetInt("parallax_steps", self.parallaxSteps) self.shader:SetFloat("parallax_depth", self.parallaxDepth) self.shader:SetFloat("parallax_rounding", self.parallaxRounding) self.shader:SetFloat("texture_size", self.texSize) end function Script:Release() self.shader:Release() mat:Release() end 1 Quote Link to comment Share on other sites More sharing options...
havenphillip Posted December 23, 2019 Author Share Posted December 23, 2019 Almost forgot that script works with these. The same as the last. I just remembered to write "uniform" in front of some things: Parallax POM.zip 1 Quote Link to comment Share on other sites More sharing options...
reepblue Posted December 23, 2019 Share Posted December 23, 2019 Only downside attaching a script to a brush is that now the brush will not collapse with the scene. 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
havenphillip Posted December 23, 2019 Author Share Posted December 23, 2019 6 hours ago, reepblue said: Only downside attaching a script to a brush is that now the brush will not collapse with the scene. What do you mean? Collapse with the scene? I hadn't tried this script on more than one entity at a time and it looks like you can't do more than one. Not sure why. Adjusting the settings on one entity adjusts the settings on others. I thought each instance of the script in play would affect only the entity it was attached to. It works better I guess just to leave the lua out of it. 1 Quote Link to comment Share on other sites More sharing options...
Yue Posted December 23, 2019 Share Posted December 23, 2019 I don't know if it's the same, but once I had a problem with changing the color of a surface in several models loaded from the editor. If you change the color on one, they would all be changed. I remember that the solution was to load the model by script again, and that way it didn't get distant every time I dragged it to the editor. Quote Link to comment Share on other sites More sharing options...
havenphillip Posted December 24, 2019 Author Share Posted December 24, 2019 1 hour ago, ?Yue? said: I don't know if it's the same, but once I had a problem with changing the color of a surface in several models loaded from the editor. If you change the color on one, they would all be changed. I remember that the solution was to load the model by script again, and that way it didn't get distant every time I dragged it to the editor. Yeah that's the problem. But I seem to have gotten around it by loading the shader outside the Start() function. I thought a script would be good, otherwise for every entity you use it on in a single scene you'd need to make a whole new shader if you wanted to adjust any of the settings. Script.diffuse = "" --path "Diffuse Map" "Texture File (*tex):tex|Texture" Script.normal = "" --path "Normal Map" "Texture File (*tex):tex|Texture" Script.specular = "" --path "Specular Map" "Texture File (*tex):tex|Texture" Script.height = "" --path "Height Map" "Texture File (*tex):tex|Texture" Script.diffuseColor = Vec4(0.4,0.4,0.5,1.0) -- color "Diffuse Hue" Script.brightness = 1.0 -- float "Brightness" Script.specIntensity = 1.0 -- float "Specular Intensity" Script.parallaxSteps = 10 -- float "Parallax Steps" Script.parallaxDepth = 0.03 -- float "Parallax Depth" Script.parallaxRounding = 0.2 -- float "Parallax Rounding" Script.texSize = 1.0 -- float "Texture Size" Script.shader = Shader:Load("Parallax/parallax_economy.shader") -- here instead of in the Start() --Script.shader = Shader:Load("Parallax/parallax.shader") -- here instead of in the Start() function Script:Start() mat = Material:Create() mat:SetTexture(self.diffuse,0) mat:SetTexture(self.normal,1) mat:SetTexture(self.specular,2) mat:SetTexture(self.height,3) mat:SetShader(self.shader) self.shader:SetVec4("diffuse_hue", self.diffuseColor) self.shader:SetFloat("diffuse_brightness", self.brightness) self.shader:SetFloat("specular_intensity", self.specIntensity) self.shader:SetInt("parallax_steps", self.parallaxSteps) self.shader:SetFloat("parallax_depth", self.parallaxDepth) self.shader:SetFloat("parallax_rounding", self.parallaxRounding) self.shader:SetFloat("texture_size", self.texSize) self.entity:SetMaterial(mat) end function Script:Release() self.shader:Release() mat:Release() end 1 Quote Link to comment Share on other sites More sharing options...
reepblue Posted December 24, 2019 Share Posted December 24, 2019 4 hours ago, havenphillip said: What do you mean? Collapse with the scene? Brushes get collapsed into the scene tree to improve performance. Once a brush has a script attached to it, it's left as a model. Josh can go into detail about what actually happens, but it's not wise to attach a script to a brush to change it's apperence. I would look into how I could read the material file and adjust the material accordingly. It would probably have to be in the MapHook function I have been meaning to try your shader for the longest time but now I want to see if I can read custom values from a mat file. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
havenphillip Posted December 24, 2019 Author Share Posted December 24, 2019 5 hours ago, ?Yue? said: So what does that mean? It's slower that way? I see some places in the community you're talking about the map hook but I haven't even touched C++ yet. I can't really make sense of it. I don't know what it would look like in Lua. If you know a better way in general to help me improve this then by all means explain it, fix it, optimize it, whatever. I still consider myself a noob and I really don't know a lot of things still. 1 Quote Link to comment Share on other sites More sharing options...
reepblue Posted December 24, 2019 Share Posted December 24, 2019 I don't think there is anything you can do as a shader artist. The implementation of how to alter the shader to get different results is a job for the actual game programmer. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
havenphillip Posted December 24, 2019 Author Share Posted December 24, 2019 7 hours ago, reepblue said: I don't think there is anything you can do as a shader artist. The implementation of how to alter the shader to get different results is a job for the actual game programmer. Alright. If there's no blatant problems with it I'm good with it. Quote Link to comment Share on other sites More sharing options...
reepblue Posted December 25, 2019 Share Posted December 25, 2019 Finally tried your shader. Works on AMD hardware running the 19.9.2 driver. This looks like something that can be used in a real game; terrific work! 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
havenphillip Posted December 25, 2019 Author Share Posted December 25, 2019 Nice. That's what I was hoping. I was pretty sure it would work but I'm no tech guy. I didn't want to speak too soon. 1 Quote Link to comment Share on other sites More sharing options...
reepblue Posted December 26, 2019 Share Posted December 26, 2019 Ok, only issue I came across is that it doesn't work with VR. 1 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
havenphillip Posted December 26, 2019 Author Share Posted December 26, 2019 Sorry dude I wouldn't even know where to begin. You just try. Sometimes it happens for you. Sometimes it doesn't. I was going to ask you, I'm trying to find a way to get collisions with materials. I saw a post you made about collision with materials for footsteps. Do you remember that? You had this code something like: local mat = Material:Load("Terrain Patch/terrain_patch.mat") local pivot = self.piv pickinfo = PickInfo() local p0 = self.entity:GetPosition(true) local p1 = Transform:Point(0,-0.2,0,self.entity,nil) ---3.84 if self.entity.world:Pick(p0,p1, pickinfo, 0, true, Collision.LineOfSight ) then if pickinfo.surface~=nil then local pickedmaterial = pickinfo.surface:GetMaterial() if pickedmaterial~=nil then local height = pickedmaterial:GetTexture(0):GetHeight() if height>self.entity:GetPosition(true).y then self.entity:Move(0,height*0.007,0) System:Print("It works") end end end end This is my problem, here: Quote Link to comment Share on other sites More sharing options...
reepblue Posted December 26, 2019 Share Posted December 26, 2019 It's ok if it doesn't work for VR. It may only be an AMD issue as the animated shaders don't render correctly ether in VR. I would not worry about it. As for the footsteps, I got the filepath of the material and used it's subfolder to determine what material type it is. I know the new engine has a Material praram that makes life easier. I should look into how to load custom material properties as I mentioned earlier. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
havenphillip Posted December 26, 2019 Author Share Posted December 26, 2019 How could I get the material height so that I could set the collision to that height? Is that even a viable option? Would that even work? Quote Link to comment Share on other sites More sharing options...
havenphillip Posted May 14, 2020 Author Share Posted May 14, 2020 Was able to get self-shadowing on the parallax and cut the edges to give it a more 3D look. The shadows slowed it down, and the edge-cutting system isn't really developed at all. There may be better ways to do it. Right now it's mostly just something to look at and poke at. If you open the shader there's a bunch of variables at the top like the light direction(in the vertex shader), the shadow alpha, depth, etc. Still want to find a cheap way to soften the shadows and maybe find a way to round/smooth those sharp mesh edges, as well as get it faster, etc. Also I tried to break down the shader into sections to make it easier to mess with and to see which segment does what. I didn't feel like I quite got the depth before as when I saw some videos of other parallax shaders they looked way better. I'm getting there, though. The picture is the previous parallax/current parallax: Parallax Rocks.zip 6 Quote Link to comment Share on other sites More sharing options...
Josh Posted May 15, 2020 Share Posted May 15, 2020 How did you make the edges extend beyond the geometry in the image on the right? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
reepblue Posted May 15, 2020 Share Posted May 15, 2020 Man, the screenshot on the right doesn't even look like Leadwerks, great work! Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
TWahl Posted May 15, 2020 Share Posted May 15, 2020 I will have to let you try this with some of the materials that I am making, when I am finished with them that is. Quote Link to comment Share on other sites More sharing options...
havenphillip Posted May 15, 2020 Author Share Posted May 15, 2020 1 hour ago, JoshMK said: How did you make the edges extend beyond the geometry in the image on the right? The trouble is getting the edges of the quad. But once you have that you can just shrink in a tiny bit and cut them off. My "alpha" is a black box that spans out from the center of the texcoords. Cut them too much and you start to see the gaps. The parallax effect is due to a depth coordinate, so it's actually sunk into the surface of the quad. So all I'm doing is cutting the repetitions of the texture beyond the quad. : quad_edge_sizing = -quad_edge_sizing; vec2 texcoord = abs(parallaxed_texcoords0.xy-0.85)*2.0/texture_size; float leftRight = clamp((quad_edge_sizing.x + texcoord.x - 1.0), 0.0, 1.0); float upDown = clamp((quad_edge_sizing.y + texcoord.y - 1.0), 0.0, 1.0); float alpha = clamp(leftRight + upDown, 0.0, 1.0); if (alpha > 0.0) discard; 1 Quote Link to comment Share on other sites More sharing options...
havenphillip Posted May 15, 2020 Author Share Posted May 15, 2020 55 minutes ago, TWahl said: I will have to let you try this with some of the materials that I am making, when I am finished with them that is. Dude I sit and drool over the stuff you're making over there. I'll gladly try it with some of your stuff. 2 Quote Link to comment Share on other sites More sharing options...
havenphillip Posted May 15, 2020 Author Share Posted May 15, 2020 1 hour ago, reepblue said: Man, the screenshot on the right doesn't even look like Leadwerks, great work! Thanks, man. It took a long time to get it there. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.