Jump to content
The Dark Mod Forums

Recommended Posts

Posted

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.

  • Like 4
Posted

Really cool. Now we just need to convert all our foliage materials :)

  • Like 1

"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

Posted

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 :wub: Do you have the time to convert some of our existing materials to use the new technique?

  • Like 1

"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

Posted

That's very nice! The shadowy silhouettes are perfect and very thiefy. :wub:

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

Posted

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.

Posted

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.

  • Like 1
Posted

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).

  • Like 1

"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

Posted

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.

Posted

I would love to see silhouettes in windows, curtains, etc. Would have to be careful when building though, to keep performance up

shadowdark50.gif keep50.gif
Posted (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 by rich_is_bored
  • Like 1
Posted

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!

"A Rhapsody Of Feigned And Ill-Invented Nonsense" - Thomas Aikenhead, On Theology, ca. 1696

Posted (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 by Serpentine
Posted
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).

  • Like 1
Posted

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 :rolleyes: )

Posted

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 :rolleyes: )

 

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.

  • Like 1
Posted

Can one of the textures be a "clear" alpha-test texture and therefore pass through a little real background detail? :huh:

 

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 ...

 

post-1779-128074524312_thumb.jpg

 

And here is what it looks like in practice as viewed in the archery practice area of the training mission...

 

post-1779-128074515393_thumb.jpg

 

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

  • Like 1
Posted

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.

Posted

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...

Posted (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 by nbohr1more

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...)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recent Status Updates

    • nbohr1more

      Cool thing: Thanksgiving break means I don't have to get my son up before dawn

      Not cool thing: My son stays up all night on my PC so I don't get much TDM time...
      · 3 replies
    • datiswous

      Does anyone know if the mission/map in this video posted by @Springheel can still be found somewhere and played? Looks like fun.
       
      · 1 reply
    • taffernicus

      I'm curious about doom and thief multiplayer netcode 😂 or how these games handle networking for multiplayer in general
      a youtube channel called battle(non)sense sometimes posts about netcode analysis
      · 2 replies
    • The Black Arrow

      Hey @Ansome, are you still around? I think it's been about 3 months since you've had an issue with an SSD, right?
      · 4 replies
    • Sotha

      Brushes: ~1300
      Patches: ~990
      Entities: ~960
      Ambients: Done, EFX: Done, Objectives: Done, Briefing, Done, Location System: Done.
      Going to final polishings before beta.
      · 0 replies
×
×
  • Create New...