Quad Rendering Code

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

Re: Quad Rendering Code

Postby Ian » Mon Oct 16, 2017 12:38 pm

Do you mean that using that keyword throws out an error or just ignores that?

It just didn't do anything, no compile error. It just did regular interpolation.

Noperspective should make textures ugly like this
Image

whilst default smooth interpolation or 1/z looks like this
Image

http://www.geeks3d.com/20130514/opengl- ... -tutorial/
Ian
 
Posts: 1216
Joined: Tue Feb 23, 2016 9:23 am

Re: Quad Rendering Code

Postby Ian » Mon Oct 16, 2017 2:58 pm

Well I fixed the issue with the bad quad. Although I am emulating quads, it's really still drawing 2 triangles, and depth testing as 2 triangles. Anyway the order was flipped from what we had it as originally
which was just
0,1,2 triangle one
0,2,3 triangle two

Anyway the quad probably wasn't planar, hence the difference in depth testing
Anyway .. looks like this now. Might make sense to looking into emulating proper depth values for the quad .. although not sure we'll need to go that far. Only an issue for non planar ones anyway.

Image
Ian
 
Posts: 1216
Joined: Tue Feb 23, 2016 9:23 am

Re: Quad Rendering Code

Postby HarryTuttle » Mon Oct 16, 2017 3:36 pm

So, if I understood well, this mean the original hw probably could have splitted a non-planar quad into triangles for proper depth testing?
User avatar
HarryTuttle
 
Posts: 558
Joined: Thu Mar 09, 2017 8:57 am

Re: Quad Rendering Code

Postby Ian » Mon Oct 16, 2017 4:09 pm

I think the original hardware just natively drew quads. The broken poly on the front of the car is still there. If you flip the triangle split it disappears. So if we natively emulate the depth value for quads it should all hopefully go away ..
Ian
 
Posts: 1216
Joined: Tue Feb 23, 2016 9:23 am

Re: Quad Rendering Code

Postby Ian » Wed Oct 18, 2017 5:41 pm

Well ..
I made a bit more progress with this tonight
I had a go at emulating the depth values for a quad, instead of using the actual value for the 2 triangles
Formula is simple, just this

Code: Select all
gl_FragDepth = ((zDepth * interp_oneOverW) + 1.0) / 2.0;


Anyway :) It finally fixed the missing poly on the car in scud.

Image

Image

Originally I thought that missing poly was a bug in the actual game or something, but nope, it was just being depth tested out. I bet this is why they probably never ported scud over, because without proper quad emulation the models just fall apart. Tesselation when I tried it only works well enough when you really ramp up the number of polys, which isn't practical.
Ian
 
Posts: 1216
Joined: Tue Feb 23, 2016 9:23 am

Re: Quad Rendering Code

Postby YoYo09 » Wed Oct 18, 2017 7:31 pm

Ian
Is this symptom related to quad rendering too?
Or is it a texture problem?

Image
YoYo09
 
Posts: 36
Joined: Mon Nov 28, 2016 7:43 pm

Re: Quad Rendering Code

Postby Bart » Wed Oct 18, 2017 10:09 pm

I think character outfits in VF3 have numerous issues related to rendering order, especially Aoi's translucent dress.

Awesome work, Ian! I don't quite understand why depth values would be incorrect for an ordinary quad that is comprised of two coplanar triangles. Why aren't they mathematically equivalent?
User avatar
Bart
Site Admin
 
Posts: 2058
Joined: Thu Sep 01, 2011 2:13 pm
Location: New York City

Re: Quad Rendering Code

Postby Ian » Thu Oct 19, 2017 1:28 am

Yoyo,
not sure, maybe. I had noticed those polys before but just assumed it was one part of the model poking through the other. Not sure they are transparent.

Ian! I don't quite understand why depth values would be incorrect for an ordinary quad that is comprised of two coplanar triangles. Why aren't they mathematically equivalent?


They are mathematically equivalent for co-planar quads. But the quads on the car aren't co-planar, they are bent :p

You can see the issue here. With the first split the quad is bent downwards. With the 2nd it's bent upwards.
Image

The proper quad emulation it's like a mix between the 2, which gives us very different depth values.

The depth issue is a lot easier to solve with tessellation. But the texturing of quads is much harder. When experimenting I increased the poly count by a factor of 10, then finally the lines on the car were the shape they were meant to be. But at 10x the polys it started to choke the renderer. But increasing the resolution brought the same problems back again. So yeah I guess this would make porting scud pretty hard without really going back and re-texturing/remodeling the cars.

This is scud race on demul. I guess this was some prototype/demo version for the dreamcast, I don't know if it was ever released?
You can see the same bug there
Image

I've honestly never seen any other renderer attempt to actually properly emulate quads, I don't know if this thing is a first or what. :)
But not quite sure what to do with the code. I'm not even sure Harry can run it on his pc.. and that's not good at all, since he has been such a major contributor to the project. I think the best idea might be to simply have 2 sets of shaders that can be switched between versions. The shader inputs are identical. That might be one way of doing it.
Ian
 
Posts: 1216
Joined: Tue Feb 23, 2016 9:23 am

Re: Quad Rendering Code

Postby Ian » Thu Oct 19, 2017 1:32 am

Yoyo
how's this ? :)
Image
Ian
 
Posts: 1216
Joined: Tue Feb 23, 2016 9:23 am

Re: Quad Rendering Code

Postby YoYo09 » Thu Oct 19, 2017 2:16 am

Ian wrote:Yoyo
how's this ? :)
Image


Awesome :D

thank Ian
YoYo09
 
Posts: 36
Joined: Mon Nov 28, 2016 7:43 pm

PreviousNext

Return to The Dark Room

Who is online

Users browsing this forum: Bing [Bot] and 2 guests