Page 4 of 4

Re: Aspect ratio of the 2D layers

PostPosted: Fri Nov 26, 2021 4:25 pm
by Bart
rokfpoewrkcpoqwkcp wrote:Apologies for posting in the dev board. I know we're not supposed to but I have a question related to this thread.
Can I fiddle the code to add an extra condition to the 'stretchBottom' bool to try and make it a tiny bit more intelligent ?

Logic would be something like,

stretchBottom = "WideBackground" && isBottom && 3D stuff being drawn

I'd like to see if it would clean up scenes like this.
peekaboo.jpg

My thinking is, you only really need a wide background to fill the gaps the wider 3d creates. If there is no 3d then the wide bg isn't needed.
Although I guess it may cause more problems than it solves for some games. :D

I take it this is the code doing the magic ?

Code: Select all
bool stretchBottom = m_config["WideBackground"].ValueAs<bool>() && isBottom;

Is it even possible to achieve this ? How would I change it ?


This is going to be an endless rabbit hole because frequently, 3D content is indeed drawn behind the loading screens (see Virtua Fighter 3 for an example). The way the Model 2 emulator solves this, AFAIK, is through Lua scripts that are custom written for each game and which monitor the game state by peeking at game RAM. You can go ahead and try to implement your idea but one problem you'll encounter is communicating between the 3D engine and 2D tilemap engine, which are entirely decoupled from each other. You'd need to place this logic somewhere in the top-level code above CModel3 (e.g., Main.cpp operates at this level) and then peek at the state of the Real3D memory to determine whether anything is being drawn. This won't be easy because there may be numerous ways to "draw nothing."

Re: Aspect ratio of the 2D layers

PostPosted: Fri Dec 03, 2021 9:16 am
by rokfpoewrkcpoqwkcp
Turns out I shouldn't of used '-wide-backgroud' for srally2 anyway. It doesn't really need it. (The sky is a poly?)
Simply learning which games work best with '-stretch' or '-wide-backgroud' is the answer.

Also, as much as I wish I were a genius computer coding ninja, I'm just a warehouse worker :). I'm not capable of complex stuff. Knowing how to drive a forklift isn't exactly a transferable skill. :(


A while ago, forum user njz3 had implemented LUA in his build,

https://github.com/njz3/model3emu/tree/VS2019_SDL2

It looks like he hit a dead end or found it too irksome to pursue, and he's massively more intelligent than me :!: . I guess it's a lot of effort for something that doesn't get Supermodel closer to it's goal of accurate emulation anyway.


Btw, while trying the '-stretch' switch I noticed the 2D layers didn't quite fill the screen.

stretch.jpg
stretch.jpg (82.71 KiB) Viewed 251 times


I found this line in Render2D.cpp,

m_correction = (UINT32)(((yRes / 384.f) * 2) + 0.5f); // for some reason the 2d layer is 2 pixels off the 3D

removing it seems to make the layers square up. Is the correction no longer needed? Does it matter what res we use for widescreen?

Re: Aspect ratio of the 2D layers

PostPosted: Fri Dec 03, 2021 2:47 pm
by Bart
I believe the correction is needed. Ian introduced it and as I recall it was done to make the instruments in Scud Race look correct (there is a slight offset between the 2D and 3D components).

Re: Aspect ratio of the 2D layers

PostPosted: Fri Dec 03, 2021 4:46 pm
by Ian
The fix wasn't made for scud, it was for everything. The 2d and 3d layers are off by 2 pixels so a correction is needed to match the original h/w.