Incorrect material/lighting in race track
isle-portable's race track (at least on isle.pizza) features dirt that is too shiny:
How it is expected to look:
Is your 2nd screenshot using SW or HW rendering?
It is HW rendering (since that's all the works on Wine).
For reference, here's software rendering (RGB Emulation) on Windows:
Could you provide a save game that takes us to this section?
A shot from OpenGL would also be useful.
There isn't really a save file that gets you here, you just have to go to the race track, build the car, and enter it.
I think a similar artifact is the too extreme shininess on the Infomaniacs hat:
If we can get that looking right then maybe that takes care of the race track.
I think some of the grey walls around the island are also affected
I'm not sure what exact values should be used to match how DirectX 5 did it's highlights and it's hard for me to adjust as I don't have the original game running anywhere.
You can adjust the formula for the highlights for the software renderer here and see if you can get results that match the original better: https://github.com/isledecomp/isle-portable/blob/bf24fa4a5791097544237be7ce14e2eaa5c10f49/miniwin/src/d3drm/backends/software/renderer.cpp#L206
I think some of the grey walls around the island are also affected
This appears to be the OpenGL 1.5 renderer? Note that it uses fixed function rendering meaning we do not have fine grained controls
You can adjust the lights specular color here:
https://github.com/isledecomp/isle-portable/blob/bf24fa4a5791097544237be7ce14e2eaa5c10f49/miniwin/src/d3drm/backends/opengl15/renderer.cpp#L277
And for the materials here: https://github.com/isledecomp/isle-portable/blob/bf24fa4a5791097544237be7ce14e2eaa5c10f49/miniwin/src/d3drm/backends/opengl15/renderer.cpp#L339
I think a similar artifact is the too extreme shininess on the Infomaniacs hat:
If we can get that looking right then maybe that takes care of the race track.
I did my best to match the highlights in that scene based on screen shots by others with what appeared to me as a sensible formula while referencing some technician details regarding d3drm lighting. I don't think I can do much better with what I have as I never played the game and do not have a good feel for what it should look like.
Maybe it's related to the fixed DirectX 5 highlights it wasn't really clear what they where supposed to be doing, just that they where not realistic.
I think some of the grey walls around the island are also affected
This appears to be the OpenGL 1.5 renderer? Note that it uses fixed function rendering meaning we do not have fine grained controls
Oh, I must have forgotten to change config.
Well if any of you can try and tweak the highlight that would be appreciated 🙂
If someone figures out the correct value for highlights in one of the 3 I'm happy to translate it to the two others.
Perhaps it would be possible to make these variables configurable though the debug interface?
Something like that could be a good idea, but right now there is only the material power value (appearance.shininess), but you could sure adjust the forumla to have a few properties that could be adjusted that way and make it easier find something suitable in real time. Would you be up for that? I don't really know how to integrate with the debug interface and I don't have any real idea of what to change about the formula either, it's really basic.
specular = angle of light ^ shininess * light color
You can now modify the shininess in real time to help find the right value.
Just start the game with --debug and adjust the slider to a value where things look right. Please make sure to test your value in more then one context and let me know if there are different cases.
If you are unable to dial in the correct value it's also helpful if you can describe in what regards it's not modifying that needs to change.
The preferred driver to do this on is Software emulation, SDL_GPU should also be fairly accurate.
This would probably be the best scene to use for comparison (easy to get to and replicate, big shiny object with some curve), could some one get me a screen shot from the original of this?
software render d3drm
https://github.com/user-attachments/assets/fe6c2aa5-fa07-469f-a87b-fec2d023c81d
Are the 3 shots all from the director software renderer? It looks like maybe it's more about angle then brightness?
Are the 3 shots all from the director software renderer? It looks like maybe it's more about angle then brightness?
Yes all same software renderer, DirectX RGB. Yeah depending on the angle the light/shininess is very different
https://github.com/user-attachments/assets/1b2bf999-e24c-47c5-9f3a-4f2f7080a37c
I wonder if the DirectX 5 lighting model got broken at some point and running the game on newer systems causes it to produce DirectX 6+ style lighting.
I think Matt has a windows 95 setup - maybe he can check
Here's LEGO Island using RGB Emulation with DX5:
https://github.com/user-attachments/assets/cb0e3bf5-aa42-49a0-a8c6-e86cdec8863d
...and DX8:
https://github.com/user-attachments/assets/931bc3d4-c50f-48b5-9149-e55fa11fec92
oh wow so there really is a difference depending on which version of DirectX you have, now I don't feel so bad for not exactly matching it :D
In case anyone is good with shaders the implementatino used for the SDL_GPU is written in HLSL and the highlight portion can be found here:
https://github.com/isledecomp/isle-portable/blob/cb199a87282028351f03ed37ba48546e84ea55d6/miniwin/src/d3drm/backends/sdl3gpu/shaders/src/SolidColor.frag.hlsl#L67
Reading a bit the difference of Ram and RGB emulation is that RGB does colored lights and Ramp doesn't, so there would be a difference there as well.
I think I have gotten very close, it's not a perfect match for either but with there being multiple different ways they where implemented originally and vary sparse details regarding it I think this is the beset I can do:
The highlight also behaves more like you would expect based on the viewing angle, my previous attempt was based on documentation that seems to have been more misleading then helpful.
For flat surfaces it looks very close to DirectX 8 and for small curves it's matching DirectX 5