.3ds wrong back/front faces

Started by
8 comments, last by steven katic 15 years, 9 months ago
In this .3ds loader I wrote, some of the faces are back faces when they should be front, and vice versa. Click here for the gbadev topic. One person on gbadev said sometimes the scale matrix for the faces can become negative.(Or something like that) How would I extract that data? Any other ideas for fixing this, are welcome. But please, go through the gbadev topic, and the topic on another forum linked to in the gbadev topic, also, as your idea may have already been suggested, and failed to fix this. And yes, I know .3ds is a bad format, and I'm planning on moving on to another format.
My Website:link(Not hosted by Gamedev)
Advertisement
Or a simpler way if you are going to change format anyway:
Tell your artists to never mirror an object, and if they have to do, attach that object to a non-mirrored one after mirrored it :)

Because when 3D studio mirror an object, it just flips the matrix, not the actually mesh!

And I have seen that problem not only with .3ds
Also by taking the SDK and coding my own exporter.
It's a bit of a pickle your in...I think...lets see,
Does this summarize you problem/post:

(1) 3ds models load and display ok in other apps, but not yours.
(2) The problem is in your normals calculation code, that you need help with to debug.

@Daivuk:
Mirroring could be the problem. I have only tested this with one model, a Wiimote/Wii Remote model. Since the left and right halves are identical, they probably are mirrored. I need to test more models.
All the models I use are either downloaded off Internet, or some bad model I attempted to model.(I'm not so good with modeling...)

@steven katic
1: Exactly.
2: Eh, well... Not exactly. I originally wrote this for Wii/GC,(homebrew)
and since Wii/GC doesn't use normals for back/front faces calculation, normals can't fix this.(Normals calc doesn't even work without crashing though...)
However, help with the resizing problem and the Wiimote model rotation/movement corresponding to the real remote issue, help with those would be great, but this .3ds issue needs solved also.
My Website:link(Not hosted by Gamedev)
it's not actually opengl you are using is it?
This may be more appropriately posted under Consoles, PDAs and stuff?
Well, this problem would be better placed in the "general 3D",(Or whatever it's called)
section, then here. This is a general 3D problem; This glitch happens on both PC and Wii. There's hardly any threads in the console section... I already posted this problem on 4 forums already. One is here on gamedev, the other one minus gbadev and gcdev, would be TehSkeen. Didn't get much help there...
My Website:link(Not hosted by Gamedev)
It does look like your running out of options for help.
I have apps(Directx and opengl) for which I have written plugins that load 3ds files with no problems. Thus, I initially thought I could help you. However, to my surprise I have not encountered most of the 3ds related problems mentioned by other posters in the threads you mention (they sound downright esoteric :)).
So that makes be biased:

I cannot help thinking that your problems may be related to finding the appropriate use of the Wii/GC API for solutions (and probably even from an API expert). What are you using, something like the DevKitPro suite?

I have looked at the source code samples (yours and DevKitPro suite) and conversions from opengl to the homebrews looks as though it would be painful(where conversions between Opengl and Directx would be a breeze in comparison).
If there were enough similarities between Opengl and the Homebrew versions to be useful, I believe you would have had tons of responses to your post already.

If you are using DevKitPro, I am aware of some (GC/wii platform?) versions of some nehe lessons. Seems like you may need some examples of textured meshes/object transformations/model loading? There is a giant Opengl knowledgebase including these things and more, here and else where. But apparently not for wii/gc homebrew APIs.

[Edited by - steven katic on July 21, 2008 6:49:28 PM]
I cannot help myself:

Its' just that it seems as though the scope you have to deal with to drill down to the root cause of your problem is still far to broad:

e.g.:
Quote:
Basically, the problem is that for some reason, sometimes,(at the exact same spot every time in it's rotation)
it displays the parts of the object that shouldn't be seen, along with some of what should be seen.(That is, it displays the back of the object, even though it shouldn't be doing that)


NB: the "sometimes" and "(at the exact same spot every time in it's rotation)"
indicates to me a possibltity of a bug/glitch in the actual API you are using.

And finally (so I don't pester you anymore): have you tested your 3ds loader code to ensure it is isolated enough to not cause side effects in your main app?
e.g. like feed the hand coded/textured cube and pyramid (from nehe converted sample) that do work , through the 3ds loader into you app to see what happens(How do I do that, you may ask).
Homebrew = Devkitpro. My Wii code uses Devkitpro and devkitPPC. Painful? It was quite easy to get the 3D code running on both Wii and PC. But I haven't ported anything to Wii from PC/GL yet, so I don't know how bad that will be. By the way, there's a homebrew library available that allows you to use openGL on Wii, instead of GX, directly. I learned and went through all of the NeHe tutorials when I was learning openGL. I know how to use textured objects with Wii/PC. There's no way it's an API bug when this happens on both Wii and PC. My loader only does one thing: Load and display a .3ds model, which is being rotated. The Wii NeHe cube/triangle draw code is wrong. Winding order is wrong, so this bug would appear. If you want screenshots of that, just ask. This bug doesn't appear in the original Wii examples, since the 3D examples don't use textures.(A 2D sprites example does, however.)(Don't know why it doesn't appear without textures... In fact, it's likewise with this loader, with the models I tested so far: the glitch only appears if the model uses textures/if texture loading is enabled)
When textures is used with the original NeHe cube/tri, the bug appears. It's the exact same glitch that this .3ds loader has.
My Website:link(Not hosted by Gamedev)
Quote:
yellowstar here:
The Wii NeHe cube/triangle draw code is wrong. Winding order is wrong, so this bug would appear.



Quote:
yellowstar at http://www.gcdev.com/smf/index.php?topic=239.0
Apparently back/front faces was the problem. I tried what you said, and it didn't work. I tried code for drawing a cube from NeHe tutorial, after modifying it to work with Wii/GC, and it worked. Now I need to figure out how to get my code to work...


Please explain.

Quote:
When textures is used with the original NeHe cube/tri, the bug appears. It's the exact same glitch that this .3ds loader has.


Then all things 3ds can safely be ruled out as irrelevant! (i.e. likely to have nothing unique that causes the problem).

Quote:
There's no way it's an API bug when this happens on both Wii and PC.


Why not?
I concede it is unlikely. But even two completely different programs can exhibit the same buggy behaviour. But if the Wii and PC APIs come from the same suite the likelihood increases.

just trying to narrow down the scope of the problem. Its still too broad to even think about a solution.

Talking to someone like this person might help (video of obj viewer on wii).

[Edited by - steven katic on July 23, 2008 5:30:21 AM]

This topic is closed to new replies.

Advertisement