Transparency on DTS models
by Mike Couture · in Torque X 3D · 02/09/2009 (5:12 pm) · 9 replies
Hello,
I am trying to import a DTS model with transparent textures on it but I keep getting this error on the bold line in the T3DTSRenderComponent:
ArgumentOutOfRangeException was unhandled
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
What can I do to fix this? Thanks!
I am trying to import a DTS model with transparent textures on it but I keep getting this error on the bold line in the T3DTSRenderComponent:
private void _ComputeBounds(List<Vector3> vertices, int vertexStart)
{
[b]Vector3 minExtent = vertices[vertexStart];[/b]
Vector3 maxExtent = vertices[vertexStart];ArgumentOutOfRangeException was unhandled
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
What can I do to fix this? Thanks!
#2
and even replaced vertexStart with 0, 1, etc, and it crashed when it hit that line, giving me the same error.
02/10/2009 (5:10 pm)
That part of the code is part of the T3DTSRenderComponent from the Torque engine. I placed some WriteLines in the code to see what is happening:Console.WriteLine(vertices[vertexStart]);
and even replaced vertexStart with 0, 1, etc, and it crashed when it hit that line, giving me the same error.
#4
Its a flat plane made in 3dmax of a leaf with transparency. It just a test I'm trying to do for transparent static objects. Its not skinned though. Have you tried to use anything transparent in your games?
02/10/2009 (7:10 pm)
Sean,Its a flat plane made in 3dmax of a leaf with transparency. It just a test I'm trying to do for transparent static objects. Its not skinned though. Have you tried to use anything transparent in your games?
#6
I used 3DS Max. I made a plane and used a png with an alpha source that was placed in the opacity slot, and set it up for dts export. It exported fine and shows up just fine in ShowTool. Has anyone successfully placed a transparent object in TX?
02/10/2009 (7:50 pm)
@PeterI used 3DS Max. I made a plane and used a png with an alpha source that was placed in the opacity slot, and set it up for dts export. It exported fine and shows up just fine in ShowTool. Has anyone successfully placed a transparent object in TX?
#7
John K.
www.envygames.com
02/12/2009 (4:04 pm)
I think the problem is that you have not defined a custom material definition. Try something like this:<FlameMaterial type="GarageGames.Torque.Materials.SimpleMaterial" name="FlameMaterial"> <NameMapping>datamodelsplayerflame</NameMapping> <TextureFilename>datamodelsplayerflame</TextureFilename> <IsTranslucent>true</IsTranslucent> <Opacity>0.35</Opacity> <LightingMode>PerPixel</LightingMode> <IsColorBlended>true</IsColorBlended> </FlameMaterial>
John K.
www.envygames.com
#8
That did it! It works perfectly now. I figured editing something in the XML would work. Thanks!
02/12/2009 (5:33 pm)
@John,That did it! It works perfectly now. I figured editing something in the XML would work. Thanks!
Torque Owner Peter Dwyer
This can happen for a number of reasons. One common reason is usually if the array counts up from zero but, your index starts counting at 1. Computers start indexing arrays from element zero (unless told t do otherwise). So the first element of your list is actually at position 0 and not position 1.
you can put a try catch wrapper around the code section and write out the values to the debug console in the catch statement.
Without seeing how you are calling this code I can't offer any other advise.
Incidentally why are your min and max set to the same value?