Transparency and Shadows (AL)
by Ivan Mandzhukov · in Torque 3D Professional · 03/29/2010 (11:51 am) · 8 replies
Hi there,
I have been working on objects that should be translucent (2%).
The problem is I wish that they should cast shadows.
This is a bit weird since translucent objects render after the regular ones.
I have applied some sort of flat shading and specular mapping on them.
Well, I have a solution - to disable transparency. They are still fine,I have shadows,no transparency.
Actually I prefer that there is a solution to this.
The second problem is I also need the transparency to be double sided with lerpAlpha blending.
This actually works fine in BL, transparency seems to be impractical in AL - no Z sorting.
Any good suggestions will be highly appreciated.
I have been working on objects that should be translucent (2%).
The problem is I wish that they should cast shadows.
This is a bit weird since translucent objects render after the regular ones.
I have applied some sort of flat shading and specular mapping on them.
Well, I have a solution - to disable transparency. They are still fine,I have shadows,no transparency.
Actually I prefer that there is a solution to this.
The second problem is I also need the transparency to be double sided with lerpAlpha blending.
This actually works fine in BL, transparency seems to be impractical in AL - no Z sorting.
Any good suggestions will be highly appreciated.
#2
We've talked about hacks for transparent objects casting shadows... where we have a special 'shadow alpha test' material setting that allows parts of your transparent surface that pass an alpha test threshold render as opaque.
After that its like Manoel said... translucent objects don't cast shadows or receive them in most games, but especially ones doing deferred rendering.
03/29/2010 (7:11 pm)
There is a newer technique called "inferred lighting" which can have transparent surfaces render deferred and then fully cast and receive shadows. Its something we want to investigate, but have not had the time to just yet. Matt Pettineo posted a lengthy blog post with a downloadable demo over here.We've talked about hacks for transparent objects casting shadows... where we have a special 'shadow alpha test' material setting that allows parts of your transparent surface that pass an alpha test threshold render as opaque.
After that its like Manoel said... translucent objects don't cast shadows or receive them in most games, but especially ones doing deferred rendering.
#3
As Manoel pointed, depth based shadows have problems with transclucent objects. I understand the disadvantage of deferred lighting - there is a lack of handling transparency.
It seems this is a complex problem.I don't want to add additional passes like rendering to a DSF target,then it means I should rewrite the whole light-prepass stuff and this is something that I don't understand in detail. I even don't understand how MRT should be reorganized.
I will decide for myself if I need transparency or not,eventually I will use shadows ,no transparency.
Thanks again!
03/30/2010 (3:36 am)
Thanks for the answers,guys!As Manoel pointed, depth based shadows have problems with transclucent objects. I understand the disadvantage of deferred lighting - there is a lack of handling transparency.
It seems this is a complex problem.I don't want to add additional passes like rendering to a DSF target,then it means I should rewrite the whole light-prepass stuff and this is something that I don't understand in detail. I even don't understand how MRT should be reorganized.
I will decide for myself if I need transparency or not,eventually I will use shadows ,no transparency.
Thanks again!
#4
03/30/2010 (6:13 am)
The safest approach is to change your design so you don't need the shadows from the translucent surfaces anymore. The most dramatic use I can thing for such shadows are projecting colored glass, and I think a custom solution can be made for such thing, like a special projector light for translucent objects, which would grab the translucent objects in its way, render them from the light perspective and use the render as a light cookie. Wouldn't work for overlaid translucent objects, but would allow cathedral windows to cast over objects inside.
#5
They will be used not very often in the scene,thus I need only 2% transparency so disabling transparency is not a real problem in my case.
03/30/2010 (11:42 am)
I'm using this for magic crystals ,they will act as items.They will be used not very often in the scene,thus I need only 2% transparency so disabling transparency is not a real problem in my case.
#6
Wait, maybe a decal could do it?
03/30/2010 (12:03 pm)
If T3D had projector lights you could fake it using a light cooking and attaching a projector to the crystals to project their "shadow" on the ground.Wait, maybe a decal could do it?
#7
03/30/2010 (3:41 pm)
Well if you want a light from your crystal anyway... use an unshadowed point light and attach a DDS cubemap as the 'cookie' texture. This will project the cubemap on each surface that recieves lighting. You can then fake some sort of shadow effect.
#8
03/31/2010 (3:20 am)
Thanks Tom,this helps a lot!
Associate Manoel Neto
Default Studio Name