I’m working on a model viewer for a Sega Saturn game, and i encounter an issue of texture deformation on faces. The Sega Saturn doesn’t use triangles but quads to generate faces and each face has its own texture (no uv mapping, non indexed vertices).
As you can see, the selected mesh has a distorsion on the face in the middle.
I know that the subject has been discussed on differents posts but i can’t find a solution that fit my project. prisoner849 posted this codepen that exactly fit what i want to do but can’t figure to use this method only by using vertices position (and not control points).
Also, is it not too performance consuming to use a custom shader (there’s a lot of different materials, on each faces of an object times the number of objects in the scene)?
Is there another way to solve this issue without using custom shader?
Did you find a correct solution since? As manthrax said, i’m surprised that there’s not an implemented option to manage this specific case as it seems to occurs often.
Have a look at this discussion of the same topic. Apparently the designers of Three.js deliberately decided to drop support for QUADS, which is at the heart of the issue.
I still believe, the issue could be overcome through shaders, but I’m thoroughly unexperienced in writing those, and my various other interests have carried me elsewhere in the meantime.
Whether its a quad, or 2 triangles shouldn’t matter. Perpective correct texture mapping is the default. It may be that your viewer is doing the projection on the software side and you’re only displaying the already transformed and projected result which WILL NOT WORK.
You have to feed threejs the raw points and let it do the projection and rendering.
You also need to create a working example that we can access via jsfiddle or similar if you want actual help, and not just waste your/peoples time.
What you are doing here is sending a picture of your car to your mechanic and asking them why the engine is rattling.
Yes i’ve also seen this discussion. I think the case of prisoner849 is a good start, i just need to figure how can i adapt his solution with vertices instead of control points (it seems that the deformation applied to the plane with the control points is the exact deformation used on the Sega Saturn).
At first, i was just quickly asking if someone had this issue. As all the data (vertices, indices, textures etc.) are in a ISO file that i read and decompile, it’s a bit complicated to isolate this specific case in a codepen, that’s why i didn’t create a working example, but i can totally do this.
Not really, as it’s a big binary file, i have to figure offsets and rebuild textures from palette and pixel indexed in a canvas, but i can export textures on png. I’ll made a codepen today and will post the link!
To add more details, the project is a website with tools that allow to edit saves from games, roms and see levels, 2D/3D models etc by importing the files (here’s a link if anyone is interested: https://game-tools-collection.com).
I have already done that on a Nintendo 64 game but as the models of the game are not complicated and the Nintendo 64 provide uvs mapping and indexed mesh, it wasn’t an issue.
Ok now I understand. Ignore everything I said. My Apologies.
You are doing this correctly as far as I can tell…
I’m gonna have to mull this over.
Is this really the raw data that the saturn uses? Or is the quad format converted into this vertex representation?
If you take a look on the window on the right, the selected line is the 4th indice of the quad and the differents texture distorsions when we change this indice. The last screenshot is the exact representation of what happen on prisoner849’s codepen (and that i want to reproduce).
Typically, what i do with the 4 indices on the right window, i duplicate the 3th indice on the 4th position and the 1st indice in the last position ([2, 1, 0, 3] > [2, 1, 0, 0, 3, 2]).