Game Development Community

Shadow, transparency and fog problem

by Kees · in Torque 3D Professional · 05/03/2009 (5:29 am) · 14 replies

I 've migrate my tgea 1.8.1 mission to torque 3D. Now there are parts of my trees missing and i don't have shadow on my road. The road and the concrete beside the road is one model. If there are dark parts behind the trees then this parts are light up. The trees stay clear in the distance, my fog settings doesn't seem to affect them.

www.k7.nl/torque3d_1.jpg

#1
05/03/2009 (7:17 am)
You need to edit the materials, try taking Z buffer off to start with.

Use the Materials Editor, it's real time (lovely!) and the transparency info is at the bottom.

img7.imageshack.us/img7/673/alphaproblems1.jpg
//LEFT IMAGE
new Material(abranch1)
{
   mapTo = "abranch1";
   basetex[0] = "abranch1";
   translucent = true;
   translucentBlendOp = LerpAlpha;
   translucentZWrite = true;
   alphaRef = 192;
};

//--------------------------------------

//RIGHT IMAGE

new Material(abranch1)
{
   mapTo = "abranch1";
   basetex[0] = "art/shapes/foliage/templates/abranch1";
   translucent = true;
  translucentBlendOp = None;
   translucentZWrite = 0;
   alphaRef = 180;  
   diffuseMap[0] = "art/shapes/foliage/templates/abranch1";
   doubleSided = "1";
   castShadows = "0";
   alphaTest = "1";
   materialCategory = "Uncategorized";
};

Be aware, messing about with translucency settings has been a little crashy for me.

My translucent edges are a little hard because that's the way I made the texture.

EDIT: Seems my crashes were caused by a bug with Billboard LODs, in the models.
#2
05/04/2009 (8:51 am)
Also not getting shadows on your road surface... make sure you don't have it as translucent with blending or emissive.
#3
05/07/2009 (3:35 pm)
Thanks Steve and Tom. You both are great.

www.k7.nl/torque3d_2.jpg
#4
05/07/2009 (3:58 pm)
Looking nice!
#5
05/07/2009 (5:18 pm)
That's a nice lookin' screenshot @ post #3!
#6
05/07/2009 (5:29 pm)
Looks great!
#8
05/09/2009 (10:14 pm)
Wow, nice screenshot :)
#9
05/13/2009 (5:28 pm)
Can anyone elaborate on how to implement the above changes into your object? My model is doing the exact same thing, and when I edit it's materials.cs literally nothing happens. I can delete all the code in there and the model is unchanged. I can't seem to find where the above code pertains to the material editor, besides a few boxes and a slider.

My model is in the shapes root of my project. How do I implement the fix?
#10
05/13/2009 (5:37 pm)
The engine reads the lowest directory materials.cs file, so if you have other folders with other materials files, it'll read/write to them and leave the higher ones untouched/unread.

Also do your changes via the editor rather than typing, that way you'll see the effect change in realtime.
#11
05/13/2009 (6:30 pm)
Alright, trying to get all the changes inputted through the materials editor. Still can't seem to make any visible changes. Am I saving incorrectly?

http://img.photobucket.com/albums/v416/mistmod/FPSGenreKit2009-05-1319-27-19-62.jpg
#12
05/13/2009 (7:13 pm)
You've got select your material you want to alter. In your pic, where it says "TerrainShadowMaterial", click that and it'll open up a big list of all available textures. Choose the texture you want to alter and it oughta do it in realtime.
#13
05/14/2009 (9:42 pm)
When I select the dropdown menu in the materials selector where "TerrainShadowMaterial" is, I can't find any of my object's textures.

What I did was make a new material, a 'palmfrond01' to match the palmfrond01.png texture and mapped it to 'frond,' the object map. I changed as many of the variables as I could to match the above //RIGHT IMAGE. Where do you change basetex, alpha test, translucent?

Still unable to make any of my changes show up.
#14
05/15/2009 (3:51 am)
Watch the video tutorial on materials www.vimeo.com/4380195. Changing basetex is just pressing edit in the diffuse map section of the material editor, and navigate to the image in the pop-up directory.