Prob with transparency in Max?
by Jason Jabaut · in Artist Corner · 01/09/2002 (12:57 pm) · 14 replies
After getting most of the player character stuff going I thought I would try making some static objects. I made my all purpose tree, created a .png file in photoshop with an alpha channel for transparency just the way it was described in these forums and put it in game.
It worked...sort of. The only problem was that the trunk of the tree would always render on top of the leaves. I could look straight through the leaves and anywhere where they crossed over the trunk I would only see the trunk and no leaves. I went back and checked the .max file and saw it was doing in there too. I tried making a really simple model, 2 crossed planes. Once again one plane would always show up over the other one. So I tried deleting the plane that would always render in the back and try a new one. Then I found out the new one would always render over the old one.
So it seems that something in Max 4.0(or something I have done to Max 4.0) makes it so that the last object I put in the max scene will always render on top if I assign a texture with an alpha channel in it.
I tried using 256x256 .png's created in photoshop 5.5 and then went I heard there might be a bug with .png's in that version I tried it in PSP and got the same error. If I made a .tga with an alpha for transparency I got the same error. This tends to make me think there is something wrong I am doing in Max 4.0. Any help would be appreciated=)
It worked...sort of. The only problem was that the trunk of the tree would always render on top of the leaves. I could look straight through the leaves and anywhere where they crossed over the trunk I would only see the trunk and no leaves. I went back and checked the .max file and saw it was doing in there too. I tried making a really simple model, 2 crossed planes. Once again one plane would always show up over the other one. So I tried deleting the plane that would always render in the back and try a new one. Then I found out the new one would always render over the old one.
So it seems that something in Max 4.0(or something I have done to Max 4.0) makes it so that the last object I put in the max scene will always render on top if I assign a texture with an alpha channel in it.
I tried using 256x256 .png's created in photoshop 5.5 and then went I heard there might be a bug with .png's in that version I tried it in PSP and got the same error. If I made a .tga with an alpha for transparency I got the same error. This tends to make me think there is something wrong I am doing in Max 4.0. Any help would be appreciated=)
About the author
#2
01/09/2002 (1:32 pm)
Thanks for the thought.....no luck though. I must be doing something totally wrong cause even if a make a box, assign "box" UVW mapping to it and assign my texture, it comes out all screwy in the same way. There is probably some setting in max you have to set. What's weird is if I render the scene it looks right, but in the max viewports and in game it looks funny. Don't feel bad Jason B., I'm a n00b too.
#3
The problem is in the render order in the game or something.
// Clocks out
01/09/2002 (1:52 pm)
Are you using a doublesided material, cos they do cause some problems at the moment. If you are try to make the model double sided in stead, makea box and colapse it in one direction so it will be a plane but with 2 sides.The problem is in the render order in the game or something.
// Clocks out
#4
Did you create the objects that you are using from scratch in Max or did you build them in another program and then import them into Max?
Sometimes when you import objects, the normal information is not correctly loaded (or was not stored in the file format at all), so Max has to take a stab in the dark at how to generate the normals. Usually it will do this right, but it can do them wrong and accidentally flip them. This can then cause objects to appear in the wrong order when rendered or displayed in the viewports. To correctt this try applying a "Normals" modifier to your object and select "flip normals".
Keep us informed on the results.
Logan
01/09/2002 (7:11 pm)
Flipped normals on the objects would also cause this result as well, but it's tough to tell without looking at the actual file.Did you create the objects that you are using from scratch in Max or did you build them in another program and then import them into Max?
Sometimes when you import objects, the normal information is not correctly loaded (or was not stored in the file format at all), so Max has to take a stab in the dark at how to generate the normals. Usually it will do this right, but it can do them wrong and accidentally flip them. This can then cause objects to appear in the wrong order when rendered or displayed in the viewports. To correctt this try applying a "Normals" modifier to your object and select "flip normals".
Keep us informed on the results.
Logan
#5
I'm totally stumped here. I tried opening the bush2.max scene that came with the example. It looked fine. I created a single plane, collasped to a editable mesh, selected all the faces and gave them an ID of 2 (so that when I tried out the bush texture it would get the leaves and not the trunk texture), planar UVW mapped it and applied the bush texture that came with it. I put the plane over the bush and looked down through it and it looked fine. If I moved the plane beneath the bush I could still see the plane through it.
I just tried opening up the bush2.max that came with the engine and I selected just the top couple faces that had the leaves texture on it and I tried moving them down beneath the other layer of leaves. Got the same error. I did nothing to the scene other than move those faces down a little. I've tried it on three different computers with three different video cards and video drivers, so I'm not thinking it's hardware. If anyone has any other ideas I would love to know.
01/10/2002 (7:07 am)
Good suggestion Clocks, unfortunately that was the second thing I tried after I tried a double sided texture. Every attempt I made was with a newly created object, so I won't run into the problems with the normals that you talked about L Foster. I appreciate the suggestions though.I'm totally stumped here. I tried opening the bush2.max scene that came with the example. It looked fine. I created a single plane, collasped to a editable mesh, selected all the faces and gave them an ID of 2 (so that when I tried out the bush texture it would get the leaves and not the trunk texture), planar UVW mapped it and applied the bush texture that came with it. I put the plane over the bush and looked down through it and it looked fine. If I moved the plane beneath the bush I could still see the plane through it.
I just tried opening up the bush2.max that came with the engine and I selected just the top couple faces that had the leaves texture on it and I tried moving them down beneath the other layer of leaves. Got the same error. I did nothing to the scene other than move those faces down a little. I've tried it on three different computers with three different video cards and video drivers, so I'm not thinking it's hardware. If anyone has any other ideas I would love to know.
#6
So one last suggestion.
What drivers are you using for the viewport in 3dmax?
Try to switch between them, Hedid (software), OpenGl and D3D.
// Clocks out
01/10/2002 (7:46 am)
Either I didnt understand your problem with the bush3.max but I just checked it and there seem to be no problem whatsoever. I moved the faces up and down etc.....So one last suggestion.
What drivers are you using for the viewport in 3dmax?
Try to switch between them, Hedid (software), OpenGl and D3D.
// Clocks out
#7
Thanks a ton for the help.
01/10/2002 (10:17 am)
Good call man. I tried changing to Heidi drivers and it works perfect. I was using Open GL before and I can't get D3D to work here at work. Maybe I can try out D3D at home. Out of curiousity what are you using, D3D, Open Gl or Heidi. I would be interested to see if anyone else using Open GL had this prob.Thanks a ton for the help.
#8
01/10/2002 (3:44 pm)
I use open gl, and I get similar problems. I think it has something to do with the scale of the objects in Max. When I scale them up, the clipping and disappearing problem usually disappears.
#9
// Clocks out
01/11/2002 (6:24 am)
I use OpenGL as well and do not have the problem, try to install the latest drivers and see if it helps.// Clocks out
#10
I tried the latest drivers and still no help. I'm really at a loss here. Any other ideas?
01/14/2002 (7:21 am)
Messed around with it more this weekend and still couldn't get it to work. What's really weird is that on the sphere in the material editor the texture looks fine, but as soon as I use it in the scene it gets messed up. All this wouldn't bother me too much except that it looks messed up in the game too.I tried the latest drivers and still no help. I'm really at a loss here. Any other ideas?
#11
BTW: Thank Joe Maruschak for the tip.
Logan
01/14/2002 (7:36 am)
Leave it as is (should be fine) but add "Sort::" to the beginning of the objects name. This way the exporter will know that the object has transparent faces and will try to ensure that they display properly in Torque.BTW: Thank Joe Maruschak for the tip.
Logan
#12
Wel thanx for messing up my day Logan ;O)
01/14/2002 (7:41 am)
Hey i was about to say that..... including the thanx to Joe bit. Wel thanx for messing up my day Logan ;O)
#13
01/14/2002 (9:36 am)
Great...I'll give it a try when I get home. Thanks=)
#14
First, it would mess up if I had a face with an alpha channel texture assigned intersecting a face that had a different texture assigned. I was able to almost always intersect faces that had the same texture assigned and have it show up right. I can make something like 2 flat planes perpendicular to each other intersecting in the middle and have it show up right. There was one case where it wouldn't work though.....
Second, it would seem to mess up if I had alpha faces intersecting alpha faces that intersected at more than one angel. This is kinda hard to explain but the test I used was to take a flat plane with a 6 sided cylinder through the middle of it, each with the same alpha texture applied to them. The plane intersects the cylinder at more than one angle, the 6 sides of the cylinder, and would mess up. Sorry if that didn't make any sense=)
The third thing was the "sort::" think that the guys above mentioned. It would all look weird if I didn't name my object "sort::
01/16/2002 (6:37 am)
After MUCH messing around with it last night I was able to find out the reasons that my objects didn't work. I figured I would post here just incase anyone else had my prob. First, it would mess up if I had a face with an alpha channel texture assigned intersecting a face that had a different texture assigned. I was able to almost always intersect faces that had the same texture assigned and have it show up right. I can make something like 2 flat planes perpendicular to each other intersecting in the middle and have it show up right. There was one case where it wouldn't work though.....
Second, it would seem to mess up if I had alpha faces intersecting alpha faces that intersected at more than one angel. This is kinda hard to explain but the test I used was to take a flat plane with a 6 sided cylinder through the middle of it, each with the same alpha texture applied to them. The plane intersects the cylinder at more than one angle, the 6 sides of the cylinder, and would mess up. Sorry if that didn't make any sense=)
The third thing was the "sort::" think that the guys above mentioned. It would all look weird if I didn't name my object "sort::
Torque Owner Jason Bertles
*shrugs*