Page 3 of 3

Re: Quad Rendering Code

PostPosted: Thu Oct 19, 2017 6:28 am
by HarryTuttle
Ian wrote: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.


I think switching rendering path is a good temporary solution, however I remember some time ago I downloaded a demo for a quad poly emulation and ran it without problems. I don't have at hand the original web page address so I don't know if it was using geometry shader and what not.

Anyway I think it might be worth a try. At least being able to directly test it with an OGL 3.3 class gpu I can try to do something with it.

Btw, great job Ian! :) It seems that Supermodel is pioneering a lot of methods/solutions that not even the official port devs did!

Re: Quad Rendering Code

PostPosted: Thu Oct 19, 2017 7:48 am
by Ian
Harry see if you can get the noperspective keyword to work on your hardware. You should get what is essentially affine texture mapping
Should be simple enough to just download some hello triangle opengl demo that uses textures and insert that keyword into a shader ..

Re: Quad Rendering Code

PostPosted: Thu Oct 19, 2017 9:32 am
by HarryTuttle
Luckily no need to run a demo, It's already working in Supermodel. This is the checkerboard floor in LeMans 24 attract intro:
lm24_01.jpeg
lm24_01.jpeg (183.86 KiB) Viewed 7454 times

Re: Quad Rendering Code

PostPosted: Thu Oct 19, 2017 10:14 am
by Ian
Yeah that looks like noperspective
The playstation look :p

In my current geometry shaders I can't seem to mix the output types. If I assign one as flat or just smooth I get a compile error in the shader.

Re: Quad Rendering Code

PostPosted: Sat Oct 21, 2017 10:16 am
by Ian
This is what it looks like the 5000 series AMD card

Image

Look at the road lol
Image

It's still performing 1/z interpolation even with the noperspective keyword. Don't know how to fix it. The hardware obviously does support it .. since its doing it in your example. But how to make this work with a geometry shader, I don't know.

This is what i'm feeding to the fragment shader
Code: Select all
//interpolated inputs from geometry shader
in GS_OUT
{
   noperspective vec2 v[4];
   noperspective float area[4];
   noperspective float oneOverW[4];

   //our regulat attributes
   //flat float   fogFactor[4];
   //flat vec3   viewVertex[4];
   noperspective vec3   viewNormal[4];      // per vertex normal vector
   noperspective vec2   texCoord[4];
   noperspective vec4   color[4];
   //flat float   fixedShade[4];
} fs_in;


This works on my nvidia card perfectly. I found on my nvidia card, using a geometry shader I can't mix the output types at all otherwise I get some strange shader compilation error, so everything has the same noperspective keyword.

Re: Quad Rendering Code

PostPosted: Sat Oct 21, 2017 12:39 pm
by HarryTuttle
Ian, don't know if it's off-topic, but what about this and this?

Re: Quad Rendering Code

PostPosted: Sat Oct 21, 2017 5:03 pm
by Ian
That's a pretty interesting demo, not seen it before. That guy IQ is scary talented :)
But not really sure it helps us that much. We still have to pass data from vertex -> geometry -> fragment shader