http://bugs.winehq.org/show_bug.cgi?id=31260
Bug #: 31260 Summary: Tomb Raider 4 Broken Lighting Product: Wine Version: 1.5.9 Platform: x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-d3d AssignedTo: wine-bugs@winehq.org ReportedBy: ezekiel000@lavabit.com Classification: Unclassified
Lighting seems to be broken in Tomb Raider 4 everything is fully lit.
Running Tomb Raider 4 from GOG.com with wine 1.5.9 on Debian 6.0.5 with nVidia official drivers 295.59.
The problem is in the Tomb Raider 4 Times Exclusive level available here: http://tombraiders.net/stella/downloads/TR4files.html#bonus
http://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #1 from David Rogers ezekiel000@lavabit.com 2012-07-19 16:52:14 CDT --- Created attachment 41060 --> http://bugs.winehq.org/attachment.cgi?id=41060 Screenshot
http://bugs.winehq.org/show_bug.cgi?id=31260
David Rogers ezekiel000@lavabit.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download URL| |http://tombraiders.net/stel | |la/downloads/TR4files.html# | |bonus
http://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #2 from David Rogers ezekiel000@lavabit.com 2012-07-19 16:53:58 CDT --- Created attachment 41061 --> http://bugs.winehq.org/attachment.cgi?id=41061 Terminal log
http://bugs.winehq.org/show_bug.cgi?id=31260
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |00cpxxx@gmail.com
--- Comment #3 from Bruno Jesus 00cpxxx@gmail.com 2012-07-19 17:12:26 CDT --- You could try again in wine git. There is another bug related to lighting that was fixed today (bug 31239), maybe they are related. Although on that bug the problem was the opposite.
http://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #4 from David Rogers ezekiel000@lavabit.com 2012-07-19 19:46:16 CDT --- I just tested it on wine git but the lighting problem is still there.
http://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #5 from David Rogers ezekiel000@lavabit.com 2012-07-20 12:57:15 CDT --- Created attachment 41072 --> http://bugs.winehq.org/attachment.cgi?id=41072 Reference screenshot of what it should look like
http://bugs.winehq.org/show_bug.cgi?id=31260
kinodont@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |kinodont@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=31260
jonas.th@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jonas.th@web.de
--- Comment #6 from jonas.th@web.de 2012-08-22 10:33:04 CDT --- The regular Tomb Raider 4 game is also broken (not just a random bonus level like the one linked), making the game barely enjoyable since it destroys the atmosphere somewhat.
Is the main game not broken for the bug reporter, or why exactly did you point out that specific level?
http://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #7 from David Rogers ezekiel000@lavabit.com 2012-08-22 11:22:11 CDT --- I linked in the bonus level because it: 1) works in wine 2) displays the same lighting bug as the main game 3) Is freely downloadable so that a developer of wine that doesn't have the full game can work on the bug.
If you look under 'Show Apps affected by this bug' above it lists the main game. The original demo for tr4 doesn't work in wine so I guess is based on an earlier build of the game engine.
http://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #8 from jonas.th@web.de 2012-08-22 11:52:18 CDT --- Ah thanks for the explanation :-) sorry for my misinterpretation, makes all sense then.
http://bugs.winehq.org/show_bug.cgi?id=31260
Paul The Tall paulthetall@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |paulthetall@gmail.com
--- Comment #9 from Paul The Tall paulthetall@gmail.com 2012-12-21 15:55:00 CST --- still there in 1.5.19.....
http://bugs.winehq.org/show_bug.cgi?id=31260
progger1986 anubis1@linux-ecke.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |anubis1@linux-ecke.de
--- Comment #10 from progger1986 anubis1@linux-ecke.de 2013-02-01 12:09:29 CST --- A small bit to make the game a bit more playable. It reduces the overall brightness of the game. Since there is no dynamic lighting working reducing brightness too much is a bad idea.
So (for Wine 1.5.23) open in wines sources dlls/wined3d/device.c
In line 3425 change the word '0xffffffff' to '0x40404040'
compile it and have a bit more fun with playing.
the value 0x40404040 i found by trying and seems to be a good value. When changing to 0x00000000 it will look as its supposed to be, but entities are black. With these changes you will see, that dynamic lighting is missing at all.
Note: I have no idea if this change will break some other games.
http://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #11 from progger1986 anubis1@linux-ecke.de 2013-02-19 04:18:08 CST --- 1.5.24 does not solve the problem.
http://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #12 from progger1986 anubis1@linux-ecke.de 2013-06-12 06:33:57 CDT --- Problem still existent in Wine 1.5.31. Will have a look with wine 1.6, when its there.
Some update to my workaround: In Win 1.5.31 its line 3450.
http://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #13 from Wylda wylda@volny.cz --- Created attachment 47246 --> http://bugs.winehq.org/attachment.cgi?id=47246 Console log from wine-1.7.11 (shortened)
Problem with dynamic lighting still present in wine-1.7.11. Console is repeatedly flooded by several thousand lines:
err:ddraw:d3d_device3_GetRenderState Unexpected texture stage state setup, returning D3DTBLEND_MODULATE - likely erroneous.
http://bugs.winehq.org/show_bug.cgi?id=31260
Wylda wylda@volny.cz changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW CC| |wylda@volny.cz Ever confirmed|0 |1
--- Comment #14 from Wylda wylda@volny.cz ---
And confirming the bug.
http://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #15 from Wylda wylda@volny.cz ---
There seems to be workaround for dynamic lighting - SW render mode. It shows even flares.
My setup: * Wine: 1.7.11 & WINVER 98 * Resolution: 640x480 16bit (1024x768 crashed later when choosing "New Game") * Render option: Software Mode * Render option: Bilinear Filtering * Render opt: No FMV (if unchecked, it will crash under SW renderer bug 31518) * Debian Squeeze 32bit * Nvidia GT240 v275.09.07
http://bugs.winehq.org/show_bug.cgi?id=31260
Igor Tarasov tarasov.igor@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |tarasov.igor@gmail.com
--- Comment #16 from Igor Tarasov tarasov.igor@gmail.com --- Just confirming it in 1.7.12.
http://bugs.winehq.org/show_bug.cgi?id=31260
Pierre Etchemaite pe-winehq@concept-micro.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |pe-winehq@concept-micro.com
--- Comment #17 from Pierre Etchemaite pe-winehq@concept-micro.com ---
Problem still exists in 1.7.18
https://bugs.winehq.org/show_bug.cgi?id=31260
andy andy86@fastwebnet.it changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |andy86@fastwebnet.it
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #18 from andy andy86@fastwebnet.it --- Problem still exist in 1.8-rc4.
https://bugs.winehq.org/show_bug.cgi?id=31260
froeschli96@yahoo.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |froeschli96@yahoo.de
--- Comment #19 from froeschli96@yahoo.de --- Still a problem...
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #20 from andy andy86@fastwebnet.it --- Hi.
I looked part of code that print "err:ddraw:d3d_device3_GetRenderState ..." error, it seems referred to alpha.
I noticed that software rendered mode disable texture mode select, and probability it disable also the alpha.
It could be that problem it's in render alpha and find way to disable alpha in hardware acceleration mode would solve the problem?
IMHO.
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #21 from Matteo Bruni matteo.mystral@gmail.com --- It seems more likely that this bug has to do with:
err:d3d:process_vertices_strided No diffuse color in source, but destination has one err:d3d:process_vertices_strided No specular color in source, but destination has one
i.e. lighting is unimplemented in process_vertices_strided().
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #22 from Henri Verbeet hverbeet@gmail.com --- (In reply to Matteo Bruni from comment #21)
It seems more likely that this bug has to do with:
err:d3d:process_vertices_strided No diffuse color in source, but destination has one err:d3d:process_vertices_strided No specular color in source, but destination has one
i.e. lighting is unimplemented in process_vertices_strided().
For what it's worth, if someone wanted to have a go at that, the GLSL implementation (shader_glsl_ffp_vertex_lighting() in particular) may be a useful reference.
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #23 from andy andy86@fastwebnet.it --- But bug still both glsl enabled and disabled. Generally in game have bug with wine glsl, disable glsl fix or partially fix problem, in this case game behaviour it's same.
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #24 from andy andy86@fastwebnet.it --- Bug still in wine 1.9.8
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #25 from andy andy86@fastwebnet.it --- I found part of source code that probability generate error output in terminal:
if (!(colorop == WINED3D_TOP_MODULATE && colorarg1 == WINED3DTA_TEXTURE && colorarg2 == WINED3DTA_CURRENT && alphaop == (tex_alpha ? WINED3D_TOP_SELECT_ARG1 : WINED3D_TOP_SELECT_ARG2) && alphaarg1 == WINED3DTA_TEXTURE && alphaarg2 == WINED3DTA_CURRENT)) ERR("Unexpected texture stage state setup, returning D3DTBLEND_MODULATE - likely erroneous.\n");
and that source file have this comment:
/* Note about D3DRENDERSTATE_TEXTUREMAPBLEND implementation: most of values for this state can be directly mapped to texture stage colorop and alphaop, but D3DTBLEND_MODULATE is tricky: it uses alpha from texture when available and alpha from diffuse otherwise. So changing the texture must be monitored in SetTexture to modify alphaarg when needed.
Aliens vs Predator 1 depends on accurate D3DTBLEND_MODULATE emulation
Legacy texture blending (TEXTUREMAPBLEND) and texture stage states: directx6 docs state that TEXTUREMAPBLEND is deprecated, yet can still be used. Games must not use both or results are undefined. D3DTBLEND_MODULATE mode in particular is dependent on texture pixel format and requires fixup of stage 0 texture states when texture changes, but this fixup can interfere with games not using this deprecated state. So a flag 'legacyTextureBlending' has to be kept in device - TRUE if the app is using TEXTUREMAPBLEND.
Tests show that setting TEXTUREMAPBLEND on native doesn't seem to change values returned by GetTextureStageState and vice versa. Not so on Wine, but it is 'undefined' anyway so, probably, ok, unless some broken game will be found that cares. */
i think this bug is right for this.
https://bugs.winehq.org/show_bug.cgi?id=31260
winetest@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |winetest@luukku.com
--- Comment #26 from winetest@luukku.com --- https://source.winehq.org/patches/
Has now lightning related patches, could someone test if they help here too?
https://bugs.winehq.org/show_bug.cgi?id=31260
Józef Kucia joseph.kucia@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |joseph.kucia@gmail.com
--- Comment #27 from Józef Kucia joseph.kucia@gmail.com ---
Has now lightning related patches, could someone test if they help here too?
These patches are unrelated to this bug.
https://bugs.winehq.org/show_bug.cgi?id=31260
legluondunet@free.fr legluondunet@free.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |legluondunet@free.fr
--- Comment #28 from legluondunet@free.fr legluondunet@free.fr --- Bug is stil present in WIne 2.21-staging:
fixme:winediag:start_process Wine Staging 2.21 is a testing version containing experimental patches. fixme:winediag:start_process Please mention your exact version when filing bug reports on winehq.org. err:winedevice:async_create_driver failed to create driver L"WineBus": c0000142 fixme:module:load_dll Loader redirect from L"wined3d.dll" to L"wined3d-csmt.dll" fixme:ddraw:ddraw_surface7_Flip Ignoring flags 0x1. fixme:ddraw:d3d_vertex_buffer7_Optimize iface 0x1785c8, device 0x171b64, flags 0 stub! err:d3d:process_vertices_strided No diffuse color in source, but destination has one err:d3d:process_vertices_strided No specular color in source, but destination has one err:ddraw:d3d_device3_GetRenderState Unexpected texture stage state setup, returning D3DTBLEND_MODULATE - likely erroneous. err:ddraw:d3d_device3_GetRenderState Unexpected texture stage state setup, returning D3DTBLEND_MODULATE - likely erroneous. err:ddraw:d3d_device3_GetRenderState Unexpected texture stage state setup, returning D3DTBLEND_MODULATE - likely erroneous. err:ddraw:d3d_device3_GetRenderState Unexpected texture stage state setup, returning D3DTBLEND_MODULATE - likely erroneous. err:ddraw:d3d_device3_GetRenderState Unexpected texture stage state setup, returning D3DTBLEND_MODULATE - likely erroneous. err:ddraw:d3d_device3_GetRenderState Unexpected texture stage state setup, returning D3DTBLEND_MODULATE - likely erroneous. err:ddraw:d3d_device3_GetRenderState Unexpected texture stage state setup, returning D3DTBLEND_MODULATE - likely erroneous. err:ddraw:d3d_device3_GetRenderState Unexpected texture stage state setup, returning D3DTBLEND_MODULATE - likely erroneous. err:ddraw:d3d_device3_GetRenderState Unexpected texture stage state setup, returning D3DTBLEND_MODULATE - likely erroneous.
https://bugs.winehq.org/show_bug.cgi?id=31260
Urbez urbez_santana@enginyeriainformatica.cat changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |urbez_santana@enginyeriainf | |ormatica.cat
--- Comment #29 from Urbez urbez_santana@enginyeriainformatica.cat --- Created attachment 60643 --> https://bugs.winehq.org/attachment.cgi?id=60643 Patch to solve the light diffusion problem.
I have wrote this patch, for add the use of the normals, to calculate the light diffusion color if the source not have it.
I hope this patch, solves correctly the light problem. The arms and legs of Lara, have the missed shadows :) We must play now the game to confirm solved.
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #30 from Urbez urbez_santana@enginyeriainformatica.cat --- MMmmm, sorry, this not solves complete the light, but shadows significantly improves the aspect of the game. I go to search what more need this game.
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #31 from Henri Verbeet hverbeet@gmail.com --- (In reply to Urbez from comment #29)
I hope this patch, solves correctly the light problem. The arms and legs of Lara, have the missed shadows :) We must play now the game to confirm solved.
That's a misunderstanding I'm afraid. The correctness of patches is verified by writing regression tests.
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #32 from andy andy86@fastwebnet.it --- (In reply to Urbez from comment #30)
I go to search what more need this game.
Hello. Have you read what i had found in my comment 25? https://bugs.winehq.org/show_bug.cgi?id=31260#c25
I think that all other implement that is just workaround... :-/
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #33 from Urbez urbez_santana@enginyeriainformatica.cat --- Hehehe, sorry. Thanks for the reply. I understand that the problem is in another location, and work in process_vertices_strided only is a workarround, this not solves the real problem, i focus now in the D3DTBLEND_MODULATE and TEXTUREMAPBLEND, and follow the use of light information and textures in the game. :) :) :) :)
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #34 from Urbez urbez_santana@enginyeriainformatica.cat --- I have found the problem of light: In ddraw/vertexbuffer.c: d3d_vertex_buffer7_ProcessVertices
Tomb raider 4, calls this with the OR of this flags: D3DVOP_TRANSFORM | D3DVOP_LIGHT
The last, D3DVOP_LIGHT is not implemented in WineD3D.
Microsoft says that this flag is normally implemented in GPU not in the CPU host, and the vertex must have normals (this is the case in TR4) if the vertex not include normals the multiply is by 0.
Next step, i try to implement using the normals and the light data the correct specular and diffuse colors.
https://bugs.winehq.org/show_bug.cgi?id=31260
max trlsmax@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |trlsmax@gmail.com
--- Comment #35 from max trlsmax@gmail.com --- The bug is still in wine 3.10.
@Urbez how above the fix ?
https://bugs.winehq.org/show_bug.cgi?id=31260
giucleand@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |giucleand@gmail.com
--- Comment #36 from giucleand@gmail.com --- Actually, there are about 3000 custom levels using variants of the executable affected by this bug, so technically this is one of the most widespread bugs (check http://trle.net/sc/search.php ).
https://bugs.winehq.org/show_bug.cgi?id=31260
Lukáš Krejčí lskrejci@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |lskrejci@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=31260
Paul Gofman gofmanp@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gofmanp@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #37 from giucleand@gmail.com --- There is a patch (Black Shadows) for FLEP which makes things comparable to progger1986's workaround. Still, Lara is still always fully lit, the water is bright and the flares won't work. It might be possible to tinker with the hex values in the patch to achieve better results, but it seems this is out of my league.
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #38 from andy andy86@fastwebnet.it --- I try dgVoodoo2 workaround by user NSTYS: https://archive.org/download/archlinux_pkg_wine/wine-3.21-1-x86_64.pkg.tar.x...
And also work with retail version. :D
Thank you NSTYS.
Just a note, with last build (wine-4.9-378-g48a74277f5) without workaround game is all black-grey, no color and light at all.
Looking at Urbez patch seems that the developers have heavily modified the source at that point.
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #39 from Paul Gofman gofmanp@gmail.com --- Created attachment 64663 --> https://bugs.winehq.org/attachment.cgi?id=64663 Compute fog in ProcessVertices, increase supported light count in ddraw
(In reply to andy from comment #38)
Just a note, with last build (wine-4.9-378-g48a74277f5) without workaround game is all black-grey, no color and light at all.
The lighting in _ProcessVertices has now been implemented, but this game needs a bit more than that for correct rendering, that is, fog coordinate computation and more active lights supported. Yes, without that it is all black or so with the current git. I am going to suggest the patches for that upstream soon and I hope it will appear in Wine after a short while. Meanwhile I am attaching those patches here in case anyone wants to try that.
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #40 from Paul Gofman gofmanp@gmail.com --- This should be fixed now in the current git, it should work now. In case of specific remaining issues I suppose separate bug reports can be created.
https://bugs.winehq.org/show_bug.cgi?id=31260
--- Comment #41 from giucleand@gmail.com --- Thank you so much! Everything looks ok now.
https://bugs.winehq.org/show_bug.cgi?id=31260
Gijs Vermeulen gijsvrm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|NEW |RESOLVED
--- Comment #42 from Gijs Vermeulen gijsvrm@gmail.com --- Reported fixed in Comment #40 and #41, marking as such.
https://bugs.winehq.org/show_bug.cgi?id=31260
Matteo Bruni matteo.mystral@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |9344d58a9ac066db6277e0fded3 | |2f5102a2409e8
https://bugs.winehq.org/show_bug.cgi?id=31260
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #43 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 4.12.