Argorius Posted December 30, 2009 Share Posted December 30, 2009 I got some assets from Dexsoft and am trying to get them ready for use in the 2.30 Editor. However, some of these assets have opaque maps and I can't get them to show up properly. There is one that has a diffuse map, normal map, specular, and an opaque map. In the mat file I usually do the following: texture0="abstract::fishnet1_diff.dds" texture1="abstract::fishnet1_nmap.dds" texture3="abstract::fishnet1_spec.dds" blend=0 depthmask=1 overlay=0 zsort=0 cullface=1 castshadows=1 specular=3.33333 gloss=0.0 bumpscale=0.3 shader="abstract::mesh_diffuse.vert","abstract::mesh_diffuse_bumpmap_specular.frag" shadowshader="abstract::mesh_shadow.vert" What do I have to write if I have an opaque map involved? on a more general note...is there some documentation that allows me to make sense of what texture 0, 1, 3, etc. is? And what type of maps belong to which texture? I am doing this mostly by trial and error but I dont understand what I am actually doing...or is someone could explain this or point me to some cool link - I'd appreciate it! Thanks! Quote Windows XP Home Edition Service Pack 3/ Intel Q9450 @ 2.67GHz / 3.5GB DDR3 SDRAM / GeForce 8800 GTS 512 Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 30, 2009 Share Posted December 30, 2009 try to set the blend value higher. 2 or 4 might do the trick. tex1 = the diffuse color tex2 = the normal mapping (bump map) tex3 = specular map (for glossines, making it more shiny) Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 30, 2009 Share Posted December 30, 2009 "abstract::mesh_diffuse_bumpmap_specular.frag" try to set the blend value higher. 2 or 4 might do the trick. tex1 = the diffuse color tex2 = the normal mapping (bump map) tex3 = specular map (for glossines, making it more shiny) He is using "..specular.frag" not "..specularmap.frag. In "..specular.frag" the specular is set by the bumpmap's alpha multiplied by the specular value you set in the material file. if he used the specularmap.frag, then it looks like its handled by texture2, where the diffuse is texture0 and the bumpmap is texture1 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...
Niosop Posted December 30, 2009 Share Posted December 30, 2009 For opacity you'll have to use one of the alpha shaders I believe. The best reference as to what to pass where is the shaders themselves. You can rename shaders.pak to shaders.zip and extract them to look at the .frag files and see what is used for what. Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender Link to comment Share on other sites More sharing options...
macklebee Posted December 30, 2009 Share Posted December 30, 2009 it looks like the alphatest looks at the diffuse texture? #ifdef LW_ALPHATEST if (diffuse.w<0.5) { discard; } #endif but offhand I don't know what the ".W" signifies... 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...
Niosop Posted December 30, 2009 Share Posted December 30, 2009 It's the alpha channel. RGBA->XYZW Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 30, 2009 Share Posted December 30, 2009 For alpha mapping I use texture0="abstract::lock.dds" blend=2 depthmask=1 overlay=0 zsort=0 cullface=1 castshadows=1 specular=0.0 gloss=0.25 bumpscale=0.3 shader="abstract::mesh_diffuse.vert","abstract::mesh_diffuse_alphatest.frag" shadowshader="abstract::mesh_shadow.vert" Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 30, 2009 Share Posted December 30, 2009 It's the alpha channel. RGBA->XYZW is that interchangeable or dependent on the texture channel? 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...
Niosop Posted December 30, 2009 Share Posted December 30, 2009 They're always xyzw AFAIK since a color is just a Vec3 or Vec4. Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender Link to comment Share on other sites More sharing options...
macklebee Posted December 30, 2009 Share Posted December 30, 2009 They're always xyzw AFAIK since a color is just a Vec3 or Vec4. well thats not what i am seeing tho... I am also seeing ".A" as well to denote the alpha... 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...
Niosop Posted December 30, 2009 Share Posted December 30, 2009 Hmm, you're right. I only see .a in a couple of places....are the places it's at working properly? I remember someone saying that specular wasn't working for them somewhere, I suppose that could be a reason if they're not interchangeable. Really not sure. Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender Link to comment Share on other sites More sharing options...
TylerH Posted December 30, 2009 Share Posted December 30, 2009 Ok guys, I asked Argorious when he PMed me with the question to post here, so since I understand what he is asking, here is the full explanation on how to do this: At lines 14- 20 in mesh.frag: #ifdef LW_DIFFUSE uniform sampler2D LW_DIFFUSE; #endif #ifdef LW_SPECULARMAP uniform sampler2D LW_SPECULARMAP; #endif Add code to make it look like this: #ifdef LW_DIFFUSE uniform sampler2D LW_DIFFUSE; #endif #ifdef LW_OPACITYMAP uniform sampler2D LW_OPACITYMAP; #endif #ifdef LW_SPECULARMAP uniform sampler2D LW_SPECULARMAP; #endif At lines 102 - 104 in mesh.frag: #ifdef LW_DIFFUSE diffuse *= texture2D(LW_DIFFUSE,texcoord);//*fOcclusionShadow; #endif Add a line to make it this: #ifdef LW_DIFFUSE diffuse *= texture2D(LW_DIFFUSE,texcoord);//*fOcclusionShadow; diffuse.w *= texture2D(LW_OPACITYMAP,texcoord).r; // Assuming you map an opacity map properly, the RGB values will all be the same. #endif Now, in any of the mesh_x_y_z.frag shaders: #define LW_OPACITYMAP texture4 In your .mat file: texture4="abstract:myopacitymap.dds" And to get the proper alpha blending: blend=1 This is what we use in Jeklynn Heights to get transparent windows with glow. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
TylerH Posted December 30, 2009 Share Posted December 30, 2009 On the note of the rgba, xyzw stuff: In GLSL, if you read the specification, the following values are all interchangeable: rgba -> xyzw -> uvst .r = .x = .u .g = .y = .v .b = .z = .s .a = .w = .t They are just all there to make it obvious what that vector variable is (color, vector, texture coord respectively). You can also do other things, like .rr, .xyxz, .yyyy, .wwst, .argb, .bgra, .uvzw They can be combined and interchanged at no cost, and even reordered like I showed. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Niosop Posted December 30, 2009 Share Posted December 30, 2009 Cool, thanks, good to know. Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender Link to comment Share on other sites More sharing options...
Argorius Posted December 30, 2009 Author Share Posted December 30, 2009 Thanks so much - that was a real helpful discussion in general for me - it made me realize a lot of things about the different maps and shaders! One of the proposed solutions by Aggror actually worked too - not sure if it made it as good as it could but using the shader he suggested with no blending and only the diff texture made the model as it should look (I think). Here is what I changed it too and this worked: texture0="abstract::fishnet1_diff.dds" blend=0 depthmask=1 overlay=0 zsort=0 cullface=0 castshadows=1 specular=0 gloss=0.05 bumpscale=0.3 shader="abstract::mesh_diffuse.vert","abstract::mesh_diffuse_alphatest.frag" shadowshader="abstract::mesh_shadow.vert" I am going to have to try Tyler's approach next - thanks for answering this! Quote Windows XP Home Edition Service Pack 3/ Intel Q9450 @ 2.67GHz / 3.5GB DDR3 SDRAM / GeForce 8800 GTS 512 Link to comment Share on other sites More sharing options...
TylerH Posted December 31, 2009 Share Posted December 31, 2009 Alpha test just discards pixels if the alpha of the diffuse map is < 0.3. I was coming from the approach if you wanted to store your alpha map in an entirely separate file (i.e. the definition of opacity map). Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
macklebee Posted December 31, 2009 Share Posted December 31, 2009 Alpha test just discards pixels if the alpha of the diffuse map is < 0.3. I was coming from the approach if you wanted to store your alpha map in an entirely separate file (i.e. the definition of opacity map). thanks for the rgba->xyzw explanation... appreciate it. seems like using a consistent referencing tho inside LE shaders would be preferable... but and i think its less than 0.5... 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...
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.