News:

Herr Otto Partz says you're all nothing but pipsqueaks!

Main Menu

Lancia LC1

Started by Ryoma, August 21, 2021, 06:23:05 PM

Previous topic - Next topic

Ryoma

3 victories too...but in one season !!!!

KyLiE

Excellent work, the dashboard looks great!  Petrolicious made a nice video on the Lancia LC1 last year.

alanrotoi

What color is transparent? 🤔

KyLiE

Stunts uses alpha masks rather than a specific colour to define transparency.  This is mentioned in the Stunts Wiki, but having a look at the dashboard graphics of an existing car in stressed will help you better understand how they work.

alanrotoi

Thanks but I dont understand how to put transparencies. Could you explain me? In steps o or just " do this and that".

KyLiE

Using Ryoma's Lancia LC1 as an example, if we open STDALLC1.VSH in stressed, we can see that the top section of the dash that has transparency is defined by the dast and dasm resources.  dast contains the main graphical elements and dasm is the transparency mask.  When viewing the mask, stressed automatically applies the transparency so it appears the same colour as the background, which is grey.  However, you can see what the actual mask image looks like by unchecking the "Alpha" option, which allows you to see the colours used:

  • Opaque: Black (RGB: 0, 0, 0 or Hex: 000000)
  • Transparent: White (RGB: 255, 255, 255 or Hex: FFFFFF)
The same method is used for transparency on other dashboard elements.  To practice, try the following exercise:

  • Open STDACDOR.VSH from your very own Melange XGT-88 in stressed.
  • Insert two new bitmap resources, one named "dast" and one named "dasm".
  • Import the attached PNG files for both new resources.
  • Set the Y values for both new resources to 110.
  • Save your changes.
Now take the car for a drive in Stunts and see what it looks like! 8)

Ryoma

#6
Good explanation KyLiE. I will try but if dash.bmp = dast.bmp and after you put white mask only on jauge for dasm.bmp...the needle color would may change.

Edit : not working. Only with ins1 and inm1 (and associated ins3 inm3)


alanrotoi

Yeah! Thank you KyLiE! I'll try it with Dodge Monaco Highway Patrol :D

Ryoma

You can see the Viper too. It's a school case using mask.

KyLiE


Cas

Not sure if this will help in any way, but this is what I know about classic 8bit-per-pixel transparency masks:

With classical computers and 8bpp graphics, the mask was usually selected to use 0 for the pixels that will display the foreground image and 255 for the pixels that will display the background image. This may appear weird, because we tend to associate 0 with black and 255 maybe with white, so it looks like the mask has its colours inverted, but there's a good reason for this.

Older computer were slow and it was important to use as few instructions as possible to produce transparency. Comparing pixel colours and including conditional jumps in the assembly code was prohibitively slow. I remember when I had to face this problem myself and I ended up solving it exactly this way because it really is the only way to make it fast with classical instructions. What the code does, and I guess this with a lot of certainty, is for every pixel...

1. AND the current background pixel against the mask pixel
2. OR the resulting screen pixel with the foreground image pixel

Only two instructions per pixel!  Nowadays, with MMX and more advance instructions, a modern alpha channel with partial transparency can even be faster than this classical trick.

I'm explaining this because I think knowing this algorithm can tell us how to exploit it to get some special effects. I'm talking about using values other than 0 and 255 in some parts of a mask. Mostly everything will look awful when doing this, but if the pixel in question is selected carefully, this can be useful. Unfortunately, one thing that cannot be done with this is changing the needle colour, as this is drawn after the instruments and surely does not use any transparency algorithm.
Earth is my country. Science is my religion.