Alpha and raytracing..

Ask questions, discuss ideas, get answers
Post Reply
User avatar
fo0k
Posts: 1433
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Alpha and raytracing..

Post by fo0k »

When running terrain raytracing on a map with Palm trees the light cuts through the individual leaves of the tree even though the actual mesh is a basic plane. The light takes the alpha into account rather than just cast a square shadow of the mesh that holds the leaf texture..

I have made a super low poly tree (SM, not TM) and when I run shadows it uses the whole mesh rather than just the opaque areas (all the black is zero alpha basically). In game the model looks fine.. but the shadow is square

Is this property of taking the alpha values into account TM specific or am I missing something..?

Image
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Alpha and raytracing..

Post by Swaffy »

Hmm ... Try using white instead of black.

I've never messed with tree meshes.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Alpha and raytracing..

Post by Apache Thunder »

I assume this is an issue with Max right? (the game's raytracer doesn't usually have this problem) The material for your object(s) that have alpha need to have the "standard" material type. not the RS material as that one does not support alpha properly when used in Max. Assign both the Diffuse Color and Opacity to your texture. You will need to adjust the settings for your Opacity texture to make it work correctly.

In the "Bitmap Parameters" there is two settings to check for. First the "Mono Channel Output" must be set to Alpha and not RGB Intensity that it usually defaults to. Then check that "Alpha Source" is also set to Alpha and not RGB Intensity. (though usually this is set correctly for you).

Once alpha is set up correctly in your max scene, the renderer will then correctly lightmap through the texture instead of the mesh. ;)

However if in the off chance this issue is occurring in the game engine's raytracer then check that there is either a transparent command or alphaTestRef command present in the RS file of your mesh. TreeMeshes only support alpha in branch and sprite meshes. So if your custom TreeMesh has the texture you shown above associated with the trunk mesh type on export, then alpha will not work. Must be branch mesh. Sprite mesh type is only used on sprites. So if your mesh is anything other then a 2D plane mesh facing north, then never use a mesh as a sprite. ;)
ImageImageImage
I have cameras in your head!
User avatar
fo0k
Posts: 1433
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: Alpha and raytracing..

Post by fo0k »

This is perfect info for rendering in max. thanks!

however, when rendering with BF I get the issues. This is not treemesh.. its all SM. It has transparency and looks correct in game although I dont have an alphaTestRef. Is this TM centric or should be used on SM too? and what does it do? :)
Archimonday
Posts: 42
Joined: Tue Oct 27, 2009 2:11 am

Re: Alpha and raytracing..

Post by Archimonday »

I don't believe the game renders the shadow based around the Alpha channel on the texture. If my mind serves me right the trees use a shadow mesh, just like the guns do and buildings as well, that is used to represent the tree when shadows are rendered. I could be mistaken though...its been awhile :P
Image
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: Alpha and raytracing..

Post by Apache Thunder »

TreeMeshes don't have shadow meshes. They only have 3 meshes when imported/exported: Trunk, Branch, and sprites. Also, shadow meshes for normal meshes are only used for dynamic shadows. The raytracer uses the main lod for tracing and will trace through alpha textures if they are present and set up correctly.
ImageImageImage
I have cameras in your head!
Post Reply