YouGroove Posted July 13, 2014 Share Posted July 13, 2014 Modifying normal map shader and copying code from environment-alpha shader from downloads section , i made some metal shader like for LE3. -------------------------------------- New Update : New version with shaders for both static and animated models. Shaders pack is available in Steam Workshop. Download link : http://www.leadwerks.com/werkspace/files/file/578-pbr-shader-effect/ 3 Quote Stop toying and make games Link to comment Share on other sites More sharing options...
YouGroove Posted July 13, 2014 Author Share Posted July 13, 2014 Better game model example from Substance in LE3 with Light intensity variation : Low Medium Stronger Very strong Over exposed Looks better in motion indeed. This is not a real metal shader but some trick that do a really good job, so to change color of metal you'll have to play with the level of metal reflection (alpha of diffuse) , the less reflective the more you'll have your diffuse colors appearing. And also play or change the skycube bitmap with different color and intensity. 1 Quote Stop toying and make games Link to comment Share on other sites More sharing options...
YouGroove Posted July 13, 2014 Author Share Posted July 13, 2014 The shader (feel free to modify or improve them) It will enhance your metallic assets like Robots, vehicles , metal or Sci fi structures , weapons, space ships and any metallic objects. Set up of the shader : Diffuse map -> alpha settings If some shader guru could invert the effect of the alpha it could be lot more logic and better : more alpha for more reflection and less texture colors showing. If someone need it, i can show some Gimp2 use to get Specular fast and some ways to easy make the Alpha channel on diffuse. For the example model above if you can download it from Substance site , i can provide the Maps i made for you to test. MetalShader.zip 1 Quote Stop toying and make games Link to comment Share on other sites More sharing options...
shadmar Posted July 13, 2014 Share Posted July 13, 2014 Looking good there YG Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
YouGroove Posted July 13, 2014 Author Share Posted July 13, 2014 Thanks Shadmar. It's based on your previous work (http://www.leadwerks.com/werkspace/files/file/531-environment-alpha/) Some questions for you : - How to invert alpha effect (multiply by -1 ?) to have more transparent = more reflection instead Actually when reflection is strong we loose all diffuse color map, the skymap reflection totally replacing it, this is very good for full silver metal materials, but in some cases we could need some color painted metal to keep it's color even on full reflective metal parts. So here is some propositions : - Uniform colored metal reflection : color multiply the skycube in the shader by a color constant (White for silver, yellow for gold etc ...) - Actually the shader works with blending replacing diffuse by skycube depending on alpha; so another solution could be : Skycube reflection result on shader multiplied by diffuse map color ( ) ; this way the skycube would keep difffuse map colors as base even at full reflection effect. Do you think it could work ? (Actually we can modify the skymap colors to change the reflective effect, but that's not so great result). Quote Stop toying and make games Link to comment Share on other sites More sharing options...
shadmar Posted July 13, 2014 Share Posted July 13, 2014 You invert alpha like this: (1.0-alpha) 1 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
YouGroove Posted July 13, 2014 Author Share Posted July 13, 2014 It's more easy to work on alpha with channel inverted now. Playing with shader alpha values also make different effects Full metal Strong metal Soft metal Strong colors We have blending : outcolor = mix(outcolor,texture(texture4,cubecoord) * 1.5 , 1-outcolor.a ); Is there a way to have the color or multiply modes on blending like painting programs ? Last shader version with new inverted Alpha : more alpha = more reflection, more opaque colors = less reflection and more texture opacity. diffNorSpecMetal2.zip Quote Stop toying and make games Link to comment Share on other sites More sharing options...
YouGroove Posted July 13, 2014 Author Share Posted July 13, 2014 Low poly rifle test (Blender swap) : Quote Stop toying and make games Link to comment Share on other sites More sharing options...
shadmar Posted July 14, 2014 Share Posted July 14, 2014 Great stuff padawan 1 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
toddgrayson Posted January 6, 2015 Share Posted January 6, 2015 I have made some modifications to the shader in this topic to work with the output from Substance Painter. To use it just export the Unity 4 Diffuse with Gloss map along with the nrmal and height map. To get the full bump you will need ot convert the height to a normal map and then combine the height map normal with the existing normal map. Everything else is the same as above. Here is an example: Substance Leadwerks You can download the updated shader here: 4 Quote Link to comment Share on other sites More sharing options...
YouGroove Posted January 15, 2015 Author Share Posted January 15, 2015 Nice. Can you explain what textures are needed in what slots of material editor ? I tried but metal don't show up ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
toddgrayson Posted January 15, 2015 Share Posted January 15, 2015 Nice. Can you explain what textures are needed in what slots of material editor ? I tried but metal don't show up ? At the very least you will need the following: A color/diffuse in the diffuse slot 0 (Note: This needs to have an alpha channel where the more opaque the more metalness or shiny it will be) A normal map in the normal slot 1 A specular map in the specular slot 2 (optional) A skybox testure in slot 4 Hope that helps. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted January 15, 2015 Author Share Posted January 15, 2015 Thanks, in fact it's same shader as mine almost. I eported diffuse with roughtness as alpha (Unity4 gloss format), i put DXT5n for diffuse, but the shader remains black ? I uploaded the diffuse (+gloss in alpha) and normal map in case you would have some time to make a test. export.zip Quote Stop toying and make games Link to comment Share on other sites More sharing options...
toddgrayson Posted January 16, 2015 Share Posted January 16, 2015 I will have a look either tonight or tomorrow morning when I get a few moments. In the meantime you could try setting the vertex color to white for your model. That may resolve your issue. If so I will see what I can do about the shader to resolve that. Note: Please also try using the shader on a Leadwerks editor model, Todd Quote Link to comment Share on other sites More sharing options...
YouGroove Posted January 16, 2015 Author Share Posted January 16, 2015 Why vertex ? Does your shader use vertex colors ? Please also try using the shader on a Leadwerks editor model, You mean BSP ? The model i use is imported in LE and displaying fine if i use other standard shaders. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
toddgrayson Posted January 16, 2015 Share Posted January 16, 2015 Why vertex ? Does your shader use vertex colors ? It takes into effect vertex alpha in conjunction with the material diffuse color, but not the actual vertex colors. So... For it not to show up as black you will need to have something other than black as the diffuse color. As well it uses the specular for brightness so if your spec color in the material is black it will show as black. You mean BSP ? The model i use is imported in LE and displaying fine if i use other standard shaders. Sorry, at one point in my testing i used an external model and it was black until I changed the vertex colors. I noticed this initially as the BSP worked. That was fixe din the final shader though so vertex colors should have no effect, but as above the material diffuse and specular do. The reason for the specular is so that you don't need to change value sin the shader itself as the spec is used. 1 Quote Link to comment Share on other sites More sharing options...
YouGroove Posted January 18, 2015 Author Share Posted January 18, 2015 Did you have some time to test ? Anyway i think i will stick with my original shader and just paint myself in 2D progam the parts i need to be reflective and the amount, this will be more easy i think to make it adapated for the shader. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
toddgrayson Posted January 18, 2015 Share Posted January 18, 2015 I did test with your textures and they worked fine in the material editor and on two other models. What GPU do you have? Also, I may be able to test better with the model as my test models show the same as your picture. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted January 18, 2015 Author Share Posted January 18, 2015 It's radeon on the 6700 HD series ( i run many today games even Unreal 4 and all shaders and effects). So it works on your models , you mean it displays ok in LE3 editor 3D viewport applying it on models , not BSP. I'll upload some model if you have some time to test ( but they are pretty standard FBX). Quote Stop toying and make games Link to comment Share on other sites More sharing options...
toddgrayson Posted January 18, 2015 Share Posted January 18, 2015 Yes, it works for me on a custom model, not bsp, I imported and displays correctly in the Leadwerks editor. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted January 29, 2015 Author Share Posted January 29, 2015 Metal shader is broken, perhaps LE3 had many changes this year with shaders that could have impacted it ? The skybox is not rendered on reflective parts , instead it's black. I'll try to fix it, or find if it is possible to make a new one ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
YouGroove Posted January 29, 2015 Author Share Posted January 29, 2015 My bad, i read the shader and skybox texture must be in slot 4 , so the shader still works as expected. What would be perfect would be to be able to colorize reflective parts with diffuse color ? The ideal would be to succed having the reflective parts to be colorized by the diffuse color and using a metal And Control reflectivity using a metal map (black and white variations instead of alpha that complicates workflow) Quote Stop toying and make games Link to comment Share on other sites More sharing options...
YouGroove Posted January 29, 2015 Author Share Posted January 29, 2015 Using TodGrayson shader Substance Painter exporting Unity 4 format : Diffuse with roughness on alpha Now the reflective parts gets colorized, it's lot more better. But some non reflective parts are reflecftive ,so it will need manual alpha adjustements on the diffuse. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
YouGroove Posted January 29, 2015 Author Share Posted January 29, 2015 I modified the shader to work with a roughness map instead of using alpha channel that was hard visualize and tweak manually. Now the rough parts stay not reflective in LE3, while metallic becomes reflective. The shader need some tweaks on reflection colors , but it is near to be really good for a standard shader trying some metallic PBR imitation. //Uniforms uniform sampler2D texture0;//diffuse map uniform sampler2D texture1;//normal map uniform sampler2D texture2;//specular map uniform sampler2D texture3;//roughness map ... //Roughness vec4 color_rought = texture(texture3,ex_texcoords0) ; ..... outcolor = mix( outcolor, ( texture(texture4,cubecoord) * color_rought ) ,color_rought ) ; Quote Stop toying and make games Link to comment Share on other sites More sharing options...
YouGroove Posted January 29, 2015 Author Share Posted January 29, 2015 Last iteration shader with texture maps : - Diffuse - normal - specular - metallic You control roughness using standard specular map , while you indicate reflectivity using a metallic map Only one thing i can't figure out how to do it is the ability to colorize the reflective part with color from the diffuse map. 1 Quote Stop toying and make games 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.