Is there a way to LightMap a .dts file outside .difs
by William Freeman · in Torque Game Engine · 05/01/2008 (4:09 pm) · 4 replies
I've looked all over for an answer to this, and I just can't seem to find one. Sorry for the double post but no one seemed to be following the art forums I first posted in ;-)
I just noticed the other day that a .dts file included in a .dif will cast prelit shadows and selfshadow just as a .dif brush will.
Question is, why can't we do this with .dts files all by there lonesome?
I've implemented the Polysoup collision code for 1.5.2 and it works incredibly well I've had hundreds of thousands of polygons going all using poly accurate collisions, including concave surfaces and got 50 fps out of it. I know that .difs have advantages in terms of portals and simplified collisions, but I havn't hit the limit yet where I'm willing to suffer through creating them. My art pipeline is based on Maya and I want to keep it that way.
So. Does any one know of a post that shows that a .dts can be considered in light mapping? Obviously included .dts files in a .dif are, so why not have it work without the .dif?
Alternatively, do any guru's out there know where I'd go in the engine code to add static .dts files to the light map?
Any help is greatly appreciated.
Colin
I just noticed the other day that a .dts file included in a .dif will cast prelit shadows and selfshadow just as a .dif brush will.
Question is, why can't we do this with .dts files all by there lonesome?
I've implemented the Polysoup collision code for 1.5.2 and it works incredibly well I've had hundreds of thousands of polygons going all using poly accurate collisions, including concave surfaces and got 50 fps out of it. I know that .difs have advantages in terms of portals and simplified collisions, but I havn't hit the limit yet where I'm willing to suffer through creating them. My art pipeline is based on Maya and I want to keep it that way.
So. Does any one know of a post that shows that a .dts can be considered in light mapping? Obviously included .dts files in a .dif are, so why not have it work without the .dif?
Alternatively, do any guru's out there know where I'd go in the engine code to add static .dts files to the light map?
Any help is greatly appreciated.
Colin
#2
The building is a .dts file included over a simple box brush. and it cast shadows on itself when the scene gets relit.
www.colins-loft.net/free/examples/dtsShadows1.jpg
The Cargo containers are .dts files sitting over the box brush floor. They are casting shadows on themselves and the floor.
www.colins-loft.net/free/examples/dtsShadows2.jpg
The .dts shapes used in the .difs above have no collision meshes associated with them.. just the mesh and thats it. So the question is, since it works great in .difs.. how do we make it work great without them?
Colin
05/01/2008 (7:38 pm)
Actually they ARE light mapped when you include them in a .dif file in constructor... see the images below for proof. You may need to hit enter after the url an additional time.. my sites acting weird.The building is a .dts file included over a simple box brush. and it cast shadows on itself when the scene gets relit.
www.colins-loft.net/free/examples/dtsShadows1.jpg
The Cargo containers are .dts files sitting over the box brush floor. They are casting shadows on themselves and the floor.
www.colins-loft.net/free/examples/dtsShadows2.jpg
The .dts shapes used in the .difs above have no collision meshes associated with them.. just the mesh and thats it. So the question is, since it works great in .difs.. how do we make it work great without them?
Colin
#3
To lightmap a DTS in code, there are different routes you can take.
The ConstructorSimpleMesh code is actually included in TGE 1.5.2 (In the Constructor folder), along with the calls to lightmap it. This could be a good starting point if you want to use this as a base.
Or, looking at TSMesh (the object in TSShape that holds the actual geometry), it looks like there was support at one time planned for lightmaps (there is a uv define for it). You may want to pursue that route.
You should probably start looking in sgSceneLighting, sgLightMap, and sgLightingInterior for information on actually doing the lighting.
Don't forget that if you animate a DTS that you lightmap, it will look bad (the shadows will move with the geometry).
Good luck, and keep us posted with your progress!
05/01/2008 (8:24 pm)
Constructor does not lightmap nor export DTS objects - What it does is import DTS objects. Once imported, they are no longer DTS objects at all, but a simplified mesh (ConstructorSimpleMesh), which is then output directly to the DIF file. The difference is important - a DTS can be animated, can change textures, can move around, etc. A ConstructorSimpleMesh is really just a bunch of static polygons.To lightmap a DTS in code, there are different routes you can take.
The ConstructorSimpleMesh code is actually included in TGE 1.5.2 (In the Constructor folder), along with the calls to lightmap it. This could be a good starting point if you want to use this as a base.
Or, looking at TSMesh (the object in TSShape that holds the actual geometry), it looks like there was support at one time planned for lightmaps (there is a uv define for it). You may want to pursue that route.
You should probably start looking in sgSceneLighting, sgLightMap, and sgLightingInterior for information on actually doing the lighting.
Don't forget that if you animate a DTS that you lightmap, it will look bad (the shadows will move with the geometry).
Good luck, and keep us posted with your progress!
#4
In the end I want the collision of Polysoup.. which I have.. and the shadows similar to the simpleMesh in a .dif
Thanks again for the explanation.
If I make any breakthroughs I'll definately post them.
05/01/2008 (10:30 pm)
Wow thats is great information.. and I get it now. Thanks so much. I think I'll start with the simple mesh code and go from there :)In the end I want the collision of Polysoup.. which I have.. and the shadows similar to the simpleMesh in a .dif
Thanks again for the explanation.
If I make any breakthroughs I'll definately post them.
Torque Owner Stefan Lundmark
DTS objects do not cast prelit shadows, nor do they selfshadow the way DIF's do. DTS objects receive dynamic DTS lighting from lights, but also grabs the lightmap color from the brush which is below them. Same with terrain.
DTS geometry isn't convex, which is what the lightmapper expects.