rich_is_bored Posted August 1, 2010 Report Posted August 1, 2010 So I've been reading over bits and pieces from the polycount wiki and I found this... http://wiki.polycount.com/NormalMap?action=show&redirect=Normal+Map#Back_Lighting_Example And I've also found a way to implement it into Doom 3... http://www.youtube.com/watch?v=KOZdTo1EmOY Generally when you make a material shader you're only permitted to use one set of diffuse, specular, and normal maps. But in the example posted on polycount they use two sets. So how do I make this work in idTech 4? It turns out it's easy. You use vertex colors like you would if you were making vertex blended terrain. The trick is to apply 50% grey to all the vertices so each set of texture maps has equal weight when everything is composited. 4 Quote ModWiki
Tels Posted August 1, 2010 Report Posted August 1, 2010 Really cool. Now we just need to convert all our foliage materials 1 Quote "The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950) "Remember: If the game lets you do it, it's not cheating." -- Xarax
rich_is_bored Posted August 1, 2010 Author Report Posted August 1, 2010 It's not just for foliage. You could also make things like curtains, space dividers, and even lampshades that don't need special skins to react appropriately to lights. 2 Quote ModWiki
Tels Posted August 1, 2010 Report Posted August 1, 2010 It's not just for foliage. You could also make things like curtains, space dividers, and even lampshades that don't need special skins to react appropriately to lights. Even more cool Do you have the time to convert some of our existing materials to use the new technique? 1 Quote "The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950) "Remember: If the game lets you do it, it's not cheating." -- Xarax
rich_is_bored Posted August 1, 2010 Author Report Posted August 1, 2010 I can bust one out every now and then. I'll try one tonight and see how it goes. 2 Quote ModWiki
Melan Posted August 1, 2010 Report Posted August 1, 2010 That's very nice! The shadowy silhouettes are perfect and very thiefy. Quote Come the time of peril, did the ground gape, and did the dead rest unquiet 'gainst us. Our bands of iron and hammers of stone prevailed not, and some did doubt the Builder's plan. But the seals held strong, and the few did triumph, and the doubters were lain into the foundations of the new sanctum. -- Collected letters of the Smith-in-Exile, Civitas Approved
Springheel Posted August 1, 2010 Report Posted August 1, 2010 Could this be used for self-lit windows? It would be awesome to see silhouettes of guards patrolling back and forth behind the windows of a mansion. Quote TDM Missions: A Score to Settle * A Reputation to Uphold * A New Job * A Matter of Hours Video Series: Springheel's Modules * Speedbuild Challenge * New Mappers Workshop * Building Traps
rich_is_bored Posted August 1, 2010 Author Report Posted August 1, 2010 Yes, it could be used for self-lit windows. Although I don't see the point of it being self-lit anymore. If you stick a light behind the window it will light up, no additive stage required. A quick rule of thumb is if the texture is opaque, then you can use this trick. 1 Quote ModWiki
Tels Posted August 1, 2010 Report Posted August 1, 2010 Yes, it could be used for self-lit windows. Although I don't see the point of it being self-lit anymore. If you stick a light behind the window it will light up, no additive stage required. A quick rule of thumb is if the texture is opaque, then you can use this trick. I thought the idea behind (no pun intended self-lit windows was that you didn't need a light for each window (or for each building). 1 Quote "The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950) "Remember: If the game lets you do it, it's not cheating." -- Xarax
Fidcal Posted August 1, 2010 Report Posted August 1, 2010 Looks great. Can you post the material shader you used? I don't understand how it is working. It's two-sided with the same texture in both the vertexcolor and inversevertexcolor stages? But I don't see how the normal map produces translucency. Quote
rebb Posted August 1, 2010 Report Posted August 1, 2010 Cool stuff, is the amount of tranclucency controllable in some way ?Possibly using the RGB Keyword on the "backfacing" diffusemap ? Quote
Komag Posted August 1, 2010 Report Posted August 1, 2010 I would love to see silhouettes in windows, curtains, etc. Would have to be careful when building though, to keep performance up Quote
rich_is_bored Posted August 1, 2010 Author Report Posted August 1, 2010 (edited) Looks great. Can you post the material shader you used? I don't understand how it is working. It's two-sided with the same texture in both the vertexcolor and inversevertexcolor stages? But I don't see how the normal map produces translucency. There isn't anything special going on there. It's practically the same thing as what you would use if you were vertex blending something. textures\leaftest { noshadows twosided { blend bumpmap map textures\leaftest\normal.tga vertexcolor } { blend diffusemap map textures\leaftest\diffuse_alpha.tga alphatest 0.1 vertexcolor } { blend bumpmap map textures\leaftest\normal_back.tga inversevertexcolor } { blend diffusemap map textures\leaftest\diffuse_back.tga alphatest 0.1 inversevertexcolor } } The trick is in the normal map. By inverting the blue channel it now faces the opposite direction. Grey vertex colors ensure both sets of textures are rendered and the most brightly lit of the two overpowers the other. Since shadows cast on the back have an impact on it's brightness, they become visible from the front. Also notice I have a different diffuse map. Basically all you need to do here is paint over the original diffuse to make it appear as it would if light was shining through it. Cool stuff, is the amount of tranclucency controllable in some way ?Possibly using the RGB Keyword on the "backfacing" diffusemap ? Just use a different value of grey for the vertex color. Edited August 1, 2010 by rich_is_bored 1 Quote ModWiki
aidakeeley Posted August 1, 2010 Report Posted August 1, 2010 Oooh let's see a curtain! I know that sounds geek, but I'm actually serious. Would love to see this. Also, if you do do, can you please put the video up somewhere to download rather than stream? Very. Very. Very. Cool! Quote "A Rhapsody Of Feigned And Ill-Invented Nonsense" - Thomas Aikenhead, On Theology, ca. 1696
New Horizon Posted August 1, 2010 Report Posted August 1, 2010 Cool, so this could be used for illuminating the globes around the gas lights as well? Quote
OrbWeaver Posted August 1, 2010 Report Posted August 1, 2010 Instead of using grey vertex colours, couldn't you just put "rgb 0.5" into every stage? Quote DarkRadiant homepage ⋄ DarkRadiant user guide ⋄ OrbWeaver's Dark Ambients ⋄ Blender export scripts
Serpentine Posted August 1, 2010 Report Posted August 1, 2010 (edited) rich, is it possible to manipulate the normal in the material def rather than making a new copy? i.e the channels can be manipulated but I dont know if it can use the result as a normal map... else this would most likely not be a viable thing on larger textures due to the size of extra normals on a slightly related topic :I've been playing with procedural generation of textures for TDM using FilterForge, using some of the example filters I came up with this in a few minutes: horrible screenshot(edit : wow the jpeg save really wasn't kind on the curtain details, the only time I use the automatic conversion to jpeg!) Hopefully I can get the hang of it, tho estimating depth and such for exported heightmaps/ao can be a challenge as you can no doubt see Edited August 1, 2010 by Serpentine Quote
OrbWeaver Posted August 1, 2010 Report Posted August 1, 2010 rich, is it possible to manipulate the normal in the material def rather than making a new copy? i.e the channels can be manipulated but I dont know if it can use the result as a normal map... else this would most likely not be a viable thing on larger textures due to the size of extra normals Try replacing the "map" statement in the bumpmap section with: map scale(path/to/normal/map, 1, 1, -1, 1) (although I haven't tested it myself). 1 Quote DarkRadiant homepage ⋄ DarkRadiant user guide ⋄ OrbWeaver's Dark Ambients ⋄ Blender export scripts
Fidcal Posted August 2, 2010 Report Posted August 2, 2010 But if the degree of translucency relies on the shade of grey you could have a real gradient transparency and hence blend a texture edge to nothing? So a grass or dirt edge model could overlay any texture in game and so provide blending? (I never give up on this holy grail ) Quote
nbohr1more Posted August 2, 2010 Report Posted August 2, 2010 (edited) Can one of the textures be a "clear" alpha-test texture and therefore pass through a little real background detail? Edited August 2, 2010 by nbohr1more Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...)
rich_is_bored Posted August 2, 2010 Author Report Posted August 2, 2010 rich, is it possible to manipulate the normal in the material def rather than making a new copy? i.e the channels can be manipulated but I dont know if it can use the result as a normal map... else this would most likely not be a viable thing on larger textures due to the size of extra normals I have a few ideas about that but I need to test them out first. Hopefully I can get the hang of it, tho estimating depth and such for exported heightmaps/ao can be a challenge as you can no doubt see Changing the depth of a normal map should be possible inside a material shader. You can probably use the addnormal keyword to blend the existing texture with a flat normal map to "smooth it out". Try replacing the "map" statement in the bumpmap section with: map scale(path/to/normal/map, 1, 1, -1, 1) (although I haven't tested it myself). That's not quite how the scale function works but it's irrelevant anyway. It's not the orientation of the image that you need to invert but rather the color represented in the blue channel. But if the degree of translucency relies on the shade of grey you could have a real gradient transparency and hence blend a texture edge to nothing? So a grass or dirt edge model could overlay any texture in game and so provide blending? (I never give up on this holy grail ) Transparency and translucency are two different things. In this specific case, we can say that the color value of vertices affects translucency but on a technical level all it's doing is specifying the influence of one set of textures in relation to another. I don't suspect you can use vertex blending to fade a texture to nothing. You have to supply an image to each stage in the shader and if you look at the shaders for invisible materials like "nodraw" they have no stages. No stages means you have no place to put the vertexcolor or inversevertexcolor keywords. I do have one idea that might coax the engine into doing what you want. I'll have to test it separately and I don't think it will work but I'll get back to you. 1 Quote ModWiki
rich_is_bored Posted August 2, 2010 Author Report Posted August 2, 2010 Can one of the textures be a "clear" alpha-test texture and therefore pass through a little real background detail? I just tried it and it doesn't work. The only options you have for transparency in conjunction with illumination are to use the alphatest or translucent (badly named keyword as it makes a material 50% transparent) keywords. Anyway, I've implemented this trick on a model ... And here is what it looks like in practice as viewed in the archery practice area of the training mission... It took a little longer than expected since I had to make a normal map. I also took the liberty of removing the shadow casting mesh. And for those who would like to see it first hand here is everything packaged in a PK4. Download 1 Quote ModWiki
STiFU Posted August 2, 2010 Report Posted August 2, 2010 I once tried blending a texture to nothing using vertexpainting and the supposedly transparent parts ended up black. But this looks very promising rich. I wonder whether this could be done easier and more comfortable with code support. Judging from JC's posts, it seems like we have a lot of access to how normalmaps etc are rendered. Maybe we could introduce a new shader keyword that automatically also uses the inverted z-values on materials... This way foliage etc. could be converted very quickly to use this technique. EDIT: Love that new screen you just posted. Faked subsurface scattering. Neat!! Looking at that screen, I see that it would of course be better to use altered diffusemaps to generate this effect, instead of just inverting the z-values just like in my proposal. Quote
STiFU Posted August 2, 2010 Report Posted August 2, 2010 Could this be used for self-lit windows? It would be awesome to see silhouettes of guards patrolling back and forth behind the windows of a mansion.While this would work according to rich, this would also mean, that the things behind the window will have to be inside the same visportal-zone as the player (or at the very least, the portal of that zone will have to be active), which probably isn't practicable in this engine. I guess it could/should only be used selectively, say if it is important to the plot... Quote
nbohr1more Posted August 2, 2010 Report Posted August 2, 2010 (edited) Wouldn't it be cheaper to play a video clip (forgot which format Doom 3 uses) of the guard's shadow in the window? (Edit: ROQ video) (Edit two: Yep a scripted GUI could even react to the guard position and play one of multiple ROQ's ... pacing back, pacing forth, idle, etc)... (Edit: Yup, Yup, Yup) ROQ in GUI at ModWiki Edited August 2, 2010 by nbohr1more Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...)
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.