Game Development Community

Invisible Tires... LW bug, or something else?

by Kevin Ostrowski · in Torque Game Engine · 02/11/2003 (3:15 pm) · 13 replies

Every time I export a vehicle with a transparent surface, ie the windshield, when I load it in the game the tires are invisible. They are there, I can drive around like normal, just visually they do not show up. Is this just an issue with the Lightwave Exporter, or has anyone else experienced this behavior with other exporters, or at all?

#1
02/26/2003 (3:38 pm)
... thats really weird, the tires should be a separate dts file than the vehicle, they shouldnt be able to effect each other like that
#2
02/26/2003 (3:59 pm)
They are separate and there is no transparency on the tires, only on the vehicle which is why it's so odd. Turn off the transparency and they show up. I know this has been reproduced by others using the LW exporter, but I want to figure out if it's LW exclusive. Has anyone exported a vehicle from Milkshape with a transparent surface?
#3
02/26/2003 (4:13 pm)
Ive had the same problem lately, its really destroyed my vehicle workflow... I change 1 thing in a scene, like add a new mesh, or adjust the bounding or mass position and the wheels disapeer... PERMANENTLY. I dont know if its a combination of script errors and scene errors or just one of those. The DTS documentation is still lacking indepth explanations and examples......... Using tribes2 vehicles is lame and dosnt work anymore.... that dosnt even work by itself... We need the documents and examples to explain the dynamics betweec the 3d editor scene and what gets exported and how it will behave in the TGE.
#4
02/26/2003 (4:41 pm)
When you say the wheels disappear permanently, are you able to still drive the vehicle? What happens to me is the tires are just invisible. All the physics are still attached to them, I can use it like normal, but there is no visible mesh or texture for the tires.
#5
02/26/2003 (5:26 pm)
the crazy and aberant behaviour is beyond description. It usually ends when the vehicle finally flies of into the sunset at mach10 or falls through the terrain...
#6
02/26/2003 (6:18 pm)
Make sure you have the latest head with all the new vehicle code. A lot of collision problems were fixed, but I don't think that's the same problem I'm having.
#7
02/28/2003 (7:31 pm)
@ Kevin I had this happen to me in MS but by exporting the tires again all is fixed. (Also this doesn't happen all the time in MS, the no wheel thing. Come to think of it I don't remember if it happened only when i used transparencies Could be just a fluke in MS) I am having the same problem as you with LW I was hoping exporting the tires again would work like it did in MS but it doesn't :(
#8
02/28/2003 (7:56 pm)
I do transparent windshield with 3dmax and It doesn't affect the tires. So, it's maybe a bug with the lightwave exporter. That's really weird like Eric said, that the vehicle affect the separated tire model.
#9
03/02/2003 (1:17 pm)
Greetings!

Well, I think I've figured out what has been causing this. It comes down to part TGE engine issues (IMHO) and part LW exporter (and MilkShape exporter). Note that I believe that 3DS Max-created DTS objects could also be affected by this problem in one circumstance.

Summary, or, How I Spent My Sunday
Because the tires are drawn within the wheeled vehicle class (see WheeledVehicle::renderImage) and are not a ShapeBase themselves, they are susceptible to certain global parameters of the parent image: static bool smNoRenderNonTranslucent and static bool smNoRenderTranslucent.

Current fix (inc. LightWave references)
To fix this today, make sure that the first object you export in the vehicle DTS does not contain a transparent material (LightWave surface).

For example: If you modeled your car to be a single object that contains transparent windshields, split your car into two objects: body and windshields. When it comes time to export, make sure that the car body is the first object and the windshields are the second object. ie: In LightWave's Layout, make sure the order that you load the objects into Layout is body and then windshield.

Regardless of how many surfaces are actually transparent, just make sure that the first LW object that is exported does not contain a transparent surface. In fact, it would be best to make sure that any LW objects that have transparent surfaces are exported last. If your first LW object contains any transparency, then your tires will be invisible.

What needs to happen to the LW Exporter?
To help prevent this from happening, I need to change the LW DTS exporter to first sort the objects according to transparency prior to writing them to the DTS file. However, even with this change, I believe that if all your objects contain some transparency (such as a glass car :o) ) then you will still have invisible tires. To prevent this from happening outright, a code change to the TGE would need to be made (IMHO).

How does this affect the MilkShape Exporter?
The MilkShape exporter and LightWave exporter share the same roots. The MilkShape exporter does not currently sort its objects according to transparency. So, if your first object happens to contain some transparency, I believe that you will see the same effects as we've seen with LightWave generated DTS objects. However, as I don't have MilkShape, I cannot personally test this.

How could this affect the 3DS Max Exporter?
This is all purely theoretical: If every material of your vehicle were to contain some amount of transparency, then you too would have invisible tires. As the Max exporter does appear to sort according to transparency prior to exporting, you'd only see this effect if everything was (partially) transparent.

What code is causing this all to happen?
Note: I've just relized that this is not a SDK forum, so my code examples here will not be complete.

The code that is indirectly causing the rendering problem with the tires is in TSShapeInstance::render(S32 dl, F32 intraDL, const Point3F * objectScale). See the definition of the 'start' and 'end' variables.

Both smNoRenderNonTranslucent and smNoRenderTranslucent are static bools of the TSShapeInstance class. They appear to control when solid or transparent objects should be drawn. However, they are not set within the TSShapeInstance class itself (which is all the wheeled vehicle tires are).

Two classes turn these global variables on or off: ShapeBase in renderObject() and TSStatic in renderObject(). The WheeledVehicle class ultimately derives itself from ShapeBase.

So, when it comes time to draw the complete car, first the body is drawn (which sets the above global flags) and then the tires (see the drawing order in WheeledVehicle::renderImage(), with the body being drawn in the call to the Parent). If the first object in the car has any transparency, then the global flags are set to only render transparent objects. As the default tires themselves do not contain any transparent materials, they end up not being rendered.

So, what's the solution? Well, I don't currently have one. It wouldn't be worth it to make the tires ShapeBase's just to handle this case. That class is much too heavy for such a simple use.

Perhaps the easiest solution at the moment is just to be aware of this issue and make sure you design your DTS objects appropriately. Essentially, any class that renders TSShapeInstance's directly without going through ShapeBase or TSStatic will exhibit this problem.

- LightWave Dave
#10
03/03/2003 (5:11 am)
Thanks for the info Dave.
#11
03/03/2003 (1:29 pm)
Nice infos Dave. I've been lucky the way I did my models transparency then. A "scrashing head" saver :) Thanks !
#12
03/11/2003 (9:18 pm)
Hello,
For the time being I will be using MS to make vehicle models and i'm running into this same problem with invisible wheels. While I do see the same LW problems replicated with MS there is a wierd fact. The default MS car works fine. I cant for the life of me figure out what is different from that MS model to mine. In fact if I open up the default car in MS and save it as somthing else the invisible problems appear.

Go figure..If I come up with anything I'll be sure to post it.
Aaron

btw I dont know if this is helpful but the buggy wheels created in MAX (I think) work fine if mixed with a MS body.
#13
03/11/2003 (10:53 pm)
From the look of it you guys are dealing with MS2DTS wierdness that I have yet deal with.. i've just started making vehicles for TFW. But I was experiencing the same sorts of wheel problems. by default the Torque example MS vehicles hold a -->opt: scale=0.1<-- value in the Materials list. If you add this value after the name of your texture like this --> myskin opt: scale=0.1 <-- your texture (wheel) will show up correctly.

I'm experimenting with the stock code and scripts dealing with MS vehicles - no alpha chan either, so my situation might be much different from everyone elses. I notice that you've narrowed the problem down to somthing dealing with objectScale. This default value does deal with a certain scale value, so just a shot in the dark maybe it's the same critter...?

Anyway, hope this might help someone around here.
Aaron