DirectDraw vs. Direct3D: Object.MergeintoBackground / TintRegions / Transparency

Started by Le Woltaire, Tue 04/08/2009 11:02:46

Previous topic - Next topic

Le Woltaire

I wanted to point out some differences that I noticed when I analyzed the graphics in my 32 bit color games in DirectDraw and later Direct3D

- The function MergeObject seems to work only in DirectDraw in Direct3D the object disappears when it gets merged.

- The region based UseColorTint does not affect the characters in Direct3D. It just seems to affect the brightness of the characters. (I just read that this also affects the TintScreen functions.)

- I got message from some players that the transparency functions like Object.SetTransparency create some flashlike effects or that Objects get displayed in a different brightness when they are partially transparent in Direct3D, but I could not reproduce this on my systems...



Pumaman

Quote- The function MergeObject seems to work only in DirectDraw in Direct3D the object disappears when it gets merged.

I have confirmed this as a bug and I'll get it fixed in the next version of AGS.

Quote- The region based UseColorTint does not affect the characters in Direct3D. It just seems to affect the brightness of the characters. (I just read that this also affects the TintScreen functions.)

I can't replicate this, the region tint seems to work fine for me with D3D. Remember that if you have used SetAmbientTint or Character.Tint then they will override the region tint.

Quote- I got message from some players that the transparency functions like Object.SetTransparency create some flashlike effects or that Objects get displayed in a different brightness when they are partially transparent in Direct3D, but I could not reproduce this on my systems...

I can't reproduce this either, if you can get somebody with this problem to post a screenshot of what they're seeing, then we can investigate from there.

Le Woltaire

Quote from: Pumaman on Sat 08/08/2009 21:30:09
I can't replicate this, the region tint seems to work fine for me with D3D. Remember that if you have used SetAmbientTint or Character.Tint then they will override the region tint.

Here is a screenshot of the compiled game with different graphic drivers...



As you see the characters do not get colored in Direct 3D but in DirectDraw...
Can someone else reproduce this?

Quote from: Pumaman on Sat 08/08/2009 21:30:09
I can't reproduce this either, if you can get somebody with this problem to post a screenshot of what they're seeing, then we can investigate from there.

As far as I can remember I got this error report from a Linux user who played the game on Wine.
Could this be the reason?



Pumaman

Quote from: Le Woltaire on Sun 09/08/2009 22:45:31
Here is a screenshot of the compiled game with different graphic drivers...

As you see the characters do not get colored in Direct 3D but in DirectDraw...
Can someone else reproduce this?

What are the region tint settings for that region?

Quote from: Pumaman on Sat 08/08/2009 21:30:09
As far as I can remember I got this error report from a Linux user who played the game on Wine.
Could this be the reason?

That's possible I guess, if the WINE Direct3D emulation is a bit dodgy.

Le Woltaire

Quote from: Pumaman on Sun 09/08/2009 23:43:49

What are the region tint settings for that region?



The room has two regions:

The tinted one is:
   Blue Tint: 0
   Green Tint: 10
   Red Tint: 0
   Tint Saturation: 50

There is another very small region in the background (next to the stairs) that does not use tint:
   Light Level: 150

I am also getting the effect in another room with different color tint settings:
   Blue Tint: 0
   Green Tint: 0
   Red Tint: 10
   Tint Saturation: 50



Pumaman

#5
Hmm, it seems that DX5 and D3D are behaving quite differently when it comes to region tints. I'm not sure why this is, because I'm sure that this was all sorted out back when AGS 3.0 was released.

For example, a tint like this:
Red: 0
Green: 10
Blue: 0
Saturation: 100

what would you expect to happen? With D3D the character goes really dark, almost black; whereas with DX5 it gets re-coloured to green.

In theory both DX5 and D3D do tinting by combining the hue and saturation of the tint colour with the luminance of the character pixel. This means that a tint of (R=0, G=5, B=0) will have the same effect as (R=0, G=100, B=0) because the hue and saturation of both colours are equal. This is what happens on DX5.

For the technical minded, what seems to be happening with the tinting is:

DX5:
(Tint Colour Hue, Tint Colour Saturation, Pixel Luminance)

D3D:
(Tint Colour, reduced by Pixel Luminance %)

Looking at it logically, what D3D is doing seems to be more useful, so I should probably change it to match DX5.

Pumaman

I have created an experimental engine build with a new D3D Pixel Shader that attempts to properly emulate the tint that the DX5 driver does.

It is here:
http://www.adventuregamestudio.co.uk/acwin.zip

Please try this out (you'll need to be using the 3.2 beta for this to work, so please try upgrading a backup copy of your game) and let me know if the character and object tints work as you would expect.

(note: this does not fix TintScreen being inconsistent, I am still working on that).

One downside of this new pixel shader is that the D3D driver now requires a DirectX 9 graphics card (the old version only needed a DX8.1 card) which increases the system requirements to use D3D mode.

Edit by strazer:
Quote from: Pumaman on Sun 03/05/2009 15:34:47
Changes in 3.2 RC 2:
* Fixed D3D Tint with luminance of 0 rendering as luminance of 100%
Changes in 3.2 RC 1:
* Fixed character/object tints in D3D not matching DX5
* Fixed TintScreen in D3D so that it looks the same as DX5

SMF spam blocked by CleanTalk