franck22000 Posted September 13, 2011 Share Posted September 13, 2011 Here is a new shader for LE it's called cone step mapping ( CSM ) and it will give you a great relief effect for your materials - CSM is very fast, it's faster and much more efficient than parralax occlusion mapping. - CSM need a cone step map that you can generate ( it take the heightmap and generate cone step map from it ). - CSM will be very good for those who want to make static scenes without gameplay. - If you want to add this in your game, remember that decals will not apply correctly on the surface of your objects with this shader applied it can look bad, you will need to lower the depth to make it not too strange. - CSM rendering is better if you use the FXAA 3.11 anti-aliasing shader. SHADER UNIFORMS conestep_depth : You can change this value to ajust the depth of the effect, be gentle with that otherwise you will get too much artifacts. DOWNLOAD (version 1.0) STANDARD INSTALLATION 1- Download the file in this post. 2- Put the 2 Shaders Presets files in the "Mesh" folder of your shaders.pak 3- Put this code in the Mesh.frag shader just before the Main() function: #ifdef LW_CONESTEP uniform sampler2D LW_CONESTEP; varying vec3 eyevec; uniform float conestep_depth = 0.08; void conestep_10step (sampler2D csmMap, inout vec3 dp, in vec3 ds) { float iz = max(abs(ds.x),abs(ds.y)); float w = 1.2; vec4 t; // 10 Steps t=texture2D(csmMap,dp.xy); dp += ds * w * (t.r - dp.z) / (iz/(t.g*t.g) + 1.0); t=texture2D(csmMap,dp.xy); dp += ds * w * (t.r - dp.z) / (iz/(t.g*t.g) + 1.0); t=texture2D(csmMap,dp.xy); dp += ds * w * (t.r - dp.z) / (iz/(t.g*t.g) + 1.0); t=texture2D(csmMap,dp.xy); dp += ds * w * (t.r - dp.z) / (iz/(t.g*t.g) + 1.0); t=texture2D(csmMap,dp.xy); dp += ds * w * (t.r - dp.z) / (iz/(t.g*t.g) + 1.0); t=texture2D(csmMap,dp.xy); dp += ds * w * (t.r - dp.z) / (iz/(t.g*t.g) + 1.0); t=texture2D(csmMap,dp.xy); dp += ds * w * (t.r - dp.z) / (iz/(t.g*t.g) + 1.0); t=texture2D(csmMap,dp.xy); dp += ds * w * (t.r - dp.z) / (iz/(t.g*t.g) + 1.0); t=texture2D(csmMap,dp.xy); dp += ds * w * (t.r - dp.z) / (iz/(t.g*t.g) + 1.0); t=texture2D(csmMap,dp.xy); dp += ds * w * (t.r - dp.z) / (iz/(t.g*t.g) + 1.0); return; } void conestep_exp(sampler2D csmMap, inout vec3 dp, vec3 ds, float dist_factor) { float iz = max(abs(ds.x), abs(ds.y)); vec4 t = texture2D(csmMap,dp.xy); float ht, old_ht; float CR = 0.0; while (t.r > dp.z) { CR = t.g * t.g; dp += ds * (dist_factor + (t.r - dp.z) * CR) / (iz + CR); t = texture2DLod(csmMap, dp.xy, 0.0); } ht = (t.r - dp.z); dist_factor /= (iz + CR); dp -= ds * dist_factor; t = texture2D(csmMap,dp.xy); old_ht = t.r - dp.z; dp += ds * dist_factor * (1.0 - clamp (ht / (ht - old_ht), 0.0, 1.0)); t = texture2D(csmMap, dp.xy); dp += ds * (t.r - dp.z) / (iz/(t.g*t.g) + 1.0); return; } #endif 4- Put this code in the Mesh.frag shader inside the Main() function just after the #ifdef LW_PARALLAXMAP section: #ifdef LW_CONESTEP float a = -conestep_depth / eyevec.z; vec3 s = vec3((eyevec * a).xy, 1); float df = 0.1 * sqrt(length(fwidth(texcoord.xy))); vec3 uv = vec3(texcoord.xy, 0); // HIGH QUALITY conestep_exp(LW_CONESTEP, uv, s, df); // LOW QUALITY //conestep_10step(LW_CONESTEP, uv, s); texcoord = uv.xy; #endif 5- It's done ! you can use the test material provided in the zip file downloaded on a 3D object to test the effect Here is 2 new screenshots to show you the effect at various angles: Quote You guys are going to be the death of me. Josh Link to comment Share on other sites More sharing options...
Roland Posted September 13, 2011 Share Posted September 13, 2011 What can I say ..... big applause :D Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Flexman Posted September 13, 2011 Share Posted September 13, 2011 He's an evil genius. I hadn't heard of Cone Step Mapping but it sounds cool and looks great. Quote 6600 2.4G / GTX 460 280.26 / 4GB Windows 7 Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT Tricubic Studios Ltd. ~ Combat Helo Link to comment Share on other sites More sharing options...
franck22000 Posted September 14, 2011 Author Share Posted September 14, 2011 Shader released have fun, hope i forgot nothing Quote You guys are going to be the death of me. Josh Link to comment Share on other sites More sharing options...
Flexman Posted September 14, 2011 Share Posted September 14, 2011 Merci. It will take me a while to look at this and check it out but I think this might work well for the rocky/gravel boundary around areas of airstrips. Certainly can't wait to try it on the interior of our Chinook helicopter which has lots of quilted padding, that should suit this shader quite well. Quote 6600 2.4G / GTX 460 280.26 / 4GB Windows 7 Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT Tricubic Studios Ltd. ~ Combat Helo Link to comment Share on other sites More sharing options...
wayneg Posted September 14, 2011 Share Posted September 14, 2011 can it do grass too ? Quote Link to comment Share on other sites More sharing options...
franck22000 Posted September 14, 2011 Author Share Posted September 14, 2011 I dont think grass will be good but you can try Quote You guys are going to be the death of me. Josh Link to comment Share on other sites More sharing options...
Flexman Posted September 15, 2011 Share Posted September 15, 2011 What makes good source files for HeightProc.exe? I takes a straight heightmap. What settings did you use for the test scene above? Quote 6600 2.4G / GTX 460 280.26 / 4GB Windows 7 Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT Tricubic Studios Ltd. ~ Combat Helo Link to comment Share on other sites More sharing options...
Naughty Alien Posted September 15, 2011 Share Posted September 15, 2011 ..ill give it a go..eventually Ill try to play and do some texture painting over this...it may look fun..nice anyway Quote Link to comment Share on other sites More sharing options...
franck22000 Posted September 15, 2011 Author Share Posted September 15, 2011 im used to generate the cone map from the heigthmap then tweak the cone map manualy like adding a little of gaussian blur to remove artifacts and minor modifications... Quote You guys are going to be the death of me. Josh Link to comment Share on other sites More sharing options...
Flexman Posted September 15, 2011 Share Posted September 15, 2011 im used to generate the cone map from the heigthmap then tweak the cone map manualy like adding a little of gaussian blur to remove artifacts and minor modifications... Sorry to be a pain, but what is the process of generating the heightmap from the diffuse? Is it a greyscale? 0 to 255? Could you provide the original heightmap you used as a reference? I'm trying to create my own and getting odd results. Quote 6600 2.4G / GTX 460 280.26 / 4GB Windows 7 Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT Tricubic Studios Ltd. ~ Combat Helo Link to comment Share on other sites More sharing options...
macklebee Posted September 15, 2011 Share Posted September 15, 2011 you could use njob to make the heightmap from the diffuse... as for the final _step DDS file, I am still attempting to reproduce the same results that franck has... without much luck... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
franck22000 Posted September 15, 2011 Author Share Posted September 15, 2011 You need to generate a heighmap ( grayscale image ) then with this just drag the heightmap on the tool provided to make a stepmap But you will not have good result if you are not editing the heigthmap yourself, you need to work on the heigth map manually to have a good depth effect without too much artifacts. Quote You guys are going to be the death of me. Josh Link to comment Share on other sites More sharing options...
Roland Posted September 15, 2011 Share Posted September 15, 2011 Regarding generation of height maps, could it be something like I'm doing in this video http://vimeo.com/26964731 Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
wailingmonkey Posted September 15, 2011 Share Posted September 15, 2011 nice work, franck22000! Quote Vista Ultimate SP1 64bit | Q6600 2.40 GHZ | 8GB RAM | 320MB Nvidia 8800GTS Link to comment Share on other sites More sharing options...
Josh Posted September 16, 2011 Share Posted September 16, 2011 Thanks for releasing this! 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...
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.