[Patch] 3D Miscellaneous

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!

[Patch] 3D Miscellaneous

Postby HarryTuttle » Wed Mar 15, 2017 6:27 am

Before going in details with fixed shading, (spot)lighting and fog, I'll attach, in preparation for next phase, these random little patches.

Changelog:

- Added caching of remaining polygon header properties. *Could* improve (?) a little bit rendering performance.

- Improved the "hacky" way to promote polygon-as-shadows to layered (stencil) type, fixing some corner case: colored balloons in ECA, speeder-bike laser beam in SWTrilogy (Endor forest chase level), etc.
I've got some idea to discuss about translucent poly and the shadows issue, but more on another topic.

- Ability to load, if present, external vertex and fragment shaders for 3D layer (like the old engine) and scroll fog. It could make debugging easier for now and may be removed on official builds. Path names are hard-coded:
[Supermodel path]/shaders/fragmentShader.glsl
[Supermodel path]/shaders/vertexShader.glsl
[Supermodel path]/shaders/fragmentShaderFog.glsl
[Supermodel path]/shaders/vertexShaderFog.glsl

Update:

Removed leftover debug string, re-uploaded patch.
Attachments
diff.zip
(2.38 KiB) Downloaded 47 times
User avatar
HarryTuttle
 
Posts: 516
Joined: Thu Mar 09, 2017 8:57 am

[Patch] 3D Miscellaneous

Postby HarryTuttle » Wed Mar 15, 2017 6:41 am

A couple of screenshots:

Before:
swt1.jpeg
Wrong laser colors
swt1.jpeg (217.16 KiB) Viewed 1010 times


After:
swt2.jpeg
Correct laser colors
swt2.jpeg (255.49 KiB) Viewed 1010 times
User avatar
HarryTuttle
 
Posts: 516
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] 3D Miscellaneous

Postby HarryTuttle » Wed Mar 15, 2017 6:50 am

Other two (note the left half of the balloons):

Before:
eca1.jpeg
Wrong shading
eca1.jpeg (226.31 KiB) Viewed 1006 times


After:
eca2.jpeg
Correct shading (well... not really correct, there's also a transparency issue)
eca2.jpeg (225.29 KiB) Viewed 1006 times
Last edited by HarryTuttle on Wed Mar 15, 2017 7:23 am, edited 1 time in total.
User avatar
HarryTuttle
 
Posts: 516
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] 3D Miscellaneous

Postby Ian » Wed Mar 15, 2017 6:56 am

What was up with the laser?
Also should that scene not have fog?
Ian
 
Posts: 1170
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] 3D Miscellaneous

Postby HarryTuttle » Wed Mar 15, 2017 7:00 am

Ian wrote:What was up with the laser?
Also should that scene not have fog?


Laser has wrong colors, the scene has fog (checked with real footage). I used the built-in shaders btw.
User avatar
HarryTuttle
 
Posts: 516
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] 3D Miscellaneous

Postby Ian » Wed Mar 15, 2017 7:03 am

How did it end up with the wrong colours ? :)
If i was to guess .. incorrectly stenciling translucent polys.. this is where hacks trip you up >_<
Ian
 
Posts: 1170
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] 3D Miscellaneous

Postby HarryTuttle » Wed Mar 15, 2017 7:17 am

Ian wrote:How did it end up with the wrong colours ? :)
If i was to guess .. incorrectly stenciling translucent polys.. this is where hacks trip you up >_<


Exactly :) That's why i tried to target specific instances of polygons used as "shadow", but it's still not perfect, there should be some issue with the shadows in skichamp.

Anyway I wouldn't bother too much since it's a hack anyway and eventually will be replaced with correct emulation.
User avatar
HarryTuttle
 
Posts: 516
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] 3D Miscellaneous

Postby Ian » Wed Mar 15, 2017 7:23 am

The actual stencil bit I found is only used *i think* by the shadows in sega rally. I don't know what other games are doing, or how the h/w is processing them.
There is a stipple alpha bit in header 6, but we aren't sure if it's used

Some of the biggest issues that remain are transparency related. If you try lemans24, it looks quite broken in places. For some reason the depth test is always enabled in the model3, so translucent polys always depth test against each other. It leads to some interesting problems on the original h/w itself.
Ian
 
Posts: 1170
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] 3D Miscellaneous

Postby HarryTuttle » Wed Mar 15, 2017 7:44 am

Ian wrote:The actual stencil bit I found is only used *i think* by the shadows in sega rally. I don't know what other games are doing, or how the h/w is processing them.
There is a stipple alpha bit in header 6, but we aren't sure if it's used

Some of the biggest issues that remain are transparency related. If you try lemans24, it looks quite broken in places. For some reason the depth test is always enabled in the model3, so translucent polys always depth test against each other. It leads to some interesting problems on the original h/w itself.


Ok let's anticipate the transparency discussion :D

I'm quite sure that translucent poly are always single sided, I've forced that condition and it seems to solve the remaining issue on meshes that have both single and double sided polys (again those colored balloons...).

I've got instead a theory about the polygon orientation: I think that the Real3D keeps dynamically their face normals toward the camera, this resolves some issues in oceanhunter (the transparent helmets in attract mode), the atmosphere halo around Endor in some open space scene in SWT, etc. Maybe that could be how "shadow-polys" are rendered without flicker, instead of implementing a co-planar check every time.

I'll post some screenshots later. But sadly I've not the skills to mess with vertex/face normals in your 3D engine. You can surely find the way faster. It could be worth a try.

About the depth test: yes, I've seen that odd effect and honestly I'd keep that (again the accuracy thing... :P )

I'm also sure that transparent-not-textured poly are rendered in another, separate, pass in the render pipeline. Last year I've made a proof-of-concept patch on the old engine and it fixed, for example, the priority (visibility) between the snow and the shadows in Sega Rally 2, maybe there're other cases.
User avatar
HarryTuttle
 
Posts: 516
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] 3D Miscellaneous

Postby HarryTuttle » Wed Mar 15, 2017 8:03 am

The "Endor anomaly":
swt3.jpeg
swt3.jpeg (86.07 KiB) Viewed 978 times

There's what seems to be a flipped triangle creating a seam.

Scuba helmets in Ocean Hunter:
oh1.jpeg
oh1.jpeg (173.05 KiB) Viewed 978 times
User avatar
HarryTuttle
 
Posts: 516
Joined: Thu Mar 09, 2017 8:57 am

Next

Return to The Dark Room

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest