Game Development Community

specular for terrain materials?

by Fyodor -bank- Osokin · in Torque 3D Professional · 06/25/2009 (3:15 am) · 15 replies

I suck @ shaders, so this is why I'm asking here..
Is it possible to add a specular to terrain materials (as alpha on normal or detail map)?
Experimenting with "arctic" area and adding some shining to detail map could bring a lot:
www.dedicatedlogic.net/_files/t3d_arctic_th.jpg

#1
06/25/2009 (9:47 am)
I was gonna experiment with it to see.

The compromise will be you'll get offset parallax mapping or a specular mask channel, but not both on the same terrain layer.
#2
06/25/2009 (10:27 am)
thanks Tom!
spec vs parallax... and the winner is... Mr. Specular!
detail+normal+spec is more than enough :)
#3
06/25/2009 (12:25 pm)
I would love spec -- since Dinosauria is largely played off the ground, spec would make a lot more visual difference to me than parallax...
#4
06/25/2009 (12:46 pm)
@Tom: since terrain was never meant to be translucent, what about the terrain texture alpha channel for specular mask?
#5
06/25/2009 (1:51 pm)
@Andy - I'll do all i can to get it in there.

@Manoel - Its that same old issue... playing a shell game with the alpha channels for different data.

I plan to include alpha masking of layers in beta 4 (this means you get a patterned fadeout of materials instead of a plain fade)... so when that is enabled the diffuse texture alpha would be used.

So now its juggling three different channels and what places to put them and what combinations. Its madness... and i still think we need to get content processing to solve it right.
#6
06/25/2009 (2:49 pm)
why not just have specular be its own map in the materials system? specular should be colorable anyway.
#7
06/25/2009 (3:07 pm)
@James - this is what my artist has been clamouring for as well.

@Tom- Thanks for all your hard work, you're a superman. :)
#8
06/25/2009 (4:42 pm)
In plain materials it would be more acceptable to have a dedicated specular map... for terrains its a much harder pill to swallow.

So lets say you have 5 materails in a cell. So to render it we need to sample 5 detail maps and 5 normal maps. And you need the lightmap/lightinfo texture and you need the layer id texture map which it needs to know where to paint the detail layers... oh and you need the base texture map. Right there we're talking 13 textures. Now lets add 5 specular maps too.... great 18 textures.

Now consider if i didn't go with the layer id map concept. If you have 5 materials you would need at least 5 opacity layers. Assuming all these layers are in order we would store 4 in one texture and 1 in the other. That would add an additional texture to bring it to 19 textures.

So to render 5 material layers on the terrain in a single pass you would have to sample 19 textures... which is not possible on any card on the market. The best you could do would be 3 draw calls to render one terrain square. 3 draw calls means 3 times the CPU cost and 3 times the fillrate.

And we haven't even considered the cheap parallax implementation we're using which costs 3 dependent texture reads per-layer.

Finally consider a 1024 terrain is made up of 64 cells where depending on your detail distances you could be rendering 50% of them with detail maps.

So to wrap up all this mess....

This is why i went to the layer id map as we only need one texture for up to 255 layers. Not one texture per-4 layers.

This is also why i'm trying to be conservative about how many textures we allow per-terrain material.

You guys all want good looking terrain with lots of high quality materials that runs fast on a 4 year old cards. Call me crazy, but i'm really doing all i can to provide that. :)
#9
06/25/2009 (5:05 pm)
Ha, yes, actually I hadn't brought up the idea of a dedicated spec map previously for these reasons. I have no problem with a monochromatic spec map in the alpha channel of the normal (with a flag to turn it from parallax to spec).
#10
06/25/2009 (8:27 pm)
@Tom
Quote:You guys all want good looking terrain with lots of high quality materials that runs fast on a 4 year old cards. Call me crazy, but i'm really doing all i can to provide that. :)

not me. I'm not going to worry about anything less than a Gf8 series. I will develop with that as the bottom of my performance curve. Not going to target anything older than 2 years. because if I take 2 years to make a game then by that as you say that will be a 4 year old card.

But I see you point and agree with what you are a saying whole heartedly you guys have done an awesome job in a short amount of time. It really is very amazing.

that being said, I think Andy is onto something with the Idea of a switch in the material. Also for terrain perhap when specular is selected you could have a color swatch. if someone need the spec colored then they can do there. Just a thought. I would thing that having the color set to something other than white would be any more intensive than having it white. Have it so the swatch is only active if the "Alpha is Spec" check box is checked.

@Fyodor

The terrain looks pretty cool a it is. But yeah spec would set it off!

@tom ... again
Is it possible to have parallax and a global specular value? perhaps this is something that also could be enabled only when the parallax is enabled.

#11
06/25/2009 (9:11 pm)
@James -

Quote:Andy is onto something with the Idea of a switch in the material

For sure... thats what we'll do.

Quote:I would thing that having the color set to something other than white would be any more intensive than having it white.
Yea i could do that... a per-material specular color with the power is easy.

Quote:Is it possible to have parallax and a global specular value?
I could allow specular without the specular mask in that case... should be easy to do.
#12
12/18/2009 (1:17 am)
Any new info on this? I've been working out a similar snow/ice scene and would gladly trade the parallax for specular.
#13
12/18/2009 (3:55 am)
It would just take someone getting into the terrain shadergen features and add a new feature for specular.

It would take me a day or two to get working, but i have a ton of other things to address.

If someone wants to take a shot at it dive in and post any questions you have here... i'll help as much as i can.
#14
12/18/2009 (1:49 pm)
I thought that you could control specular with the amount of whiteness/lightness on your detail map?

Not exactly a true specular I know, but it does the same effect.
#15
06/14/2011 (10:47 pm)
Did anything ever happen to this suggestion? I'm in the same place now, where my team could really use that specular for terrain :)
#16
07/18/2011 (10:55 am)
What about using Sahara?