Opacity
Moderators: BigEvilCorporation, Mask of Destiny
Opacity
I know the Genesis/Mega Drive doesn't have hardware opacity for sprites or layers, but I've seen it in a few games where it doesn't look dithered (Crusaders of Centy/Soleil, Adventures of Batman & Robin, etc).
How can this be achieved? I thought I saw something a while back about layers and sprite priorities and messing with that to get a silhouette type of opacity, but I haven't been able to do that.
Any ideas?
How can this be achieved? I thought I saw something a while back about layers and sprite priorities and messing with that to get a silhouette type of opacity, but I haven't been able to do that.
Any ideas?
-
- Very interested
- Posts: 2442
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
Shadow/Highlight mode
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
- Very interested
- Posts: 292
- Joined: Sat Apr 21, 2007 1:14 am
Re: Opacity
Here's how it works. I'll use Jackie Chan's Action Kung Fu as it has a clear example:How can this be achieved? I thought I saw something a while back about layers and sprite priorities and messing with that to get a silhouette type of opacity, but I haven't been able to do that.
The background actually looks like this, note that the pillars use a darker palette:
And here are the sprites. The two people are low priority sprites that are defined earlier in the sprite list, and the two pillars with a brighter palette are high priority sprites that are defined _later_ in the sprite list:
When two sprites overlap, the first one defined in the sprite list is drawn. That's why the people are overlapping the pillars in the sprites-only image.
But when the sprite layer is composited with the background layers, the two low-priority people go behind the darker pillar that's drawn on the background layer, and the remaining portion of the sprite pillars appear on top of the background layer:
Here, the dark part of their silhouette is actually the background tiles of the dark pillar you saw in an earlier image.
So the general idea is for transparency is:
1. Draw the graphics you want to see normally as a high priority sprite.
2. Draw identical but darker (or lighter, etc.) graphics on the background layer beneath it.
3. Pass a low priority sprite in the shape of the silhouette you want through them, to reveal the darker background layer through the lighter high priority sprite.
You can use this in a couple of different ways. The background graphics could have been brighter and the sprites could have been darker so you'd have a light silhouette instead of a dark one. Or instead of just changing brightness, the colors could have been changed instead. It could have been a red silhouette appearing through a green pillar.
You can also put low priority sprites behind the background to 'cut out' irregular shapes into high priority sprites that are defined later in the sprite list, like this:
The gray object in the middle is a high priority sprite that is a complete circle. There are two small black circles that are low-priority sprites defined earlier in the list which "cut out" circular chunks of the gray sprite.
But they are behind the background layer so you don't see them, you only see the missing parts of the high priority sprite.
Anyway hope that makes it clearer.
Re: Opacity
Thanks Charles! Just a couple of questions:
Does this require shadow/hilight to be enabled?
Also, the character sprites need to be a lower priority early in the list, and the bright pillars are high priority later in the list. Wouldn't that make the character sprites places behind the bright pillars by default, or did you place them in top just as an example?
Thanks!
Does this require shadow/hilight to be enabled?
Also, the character sprites need to be a lower priority early in the list, and the bright pillars are high priority later in the list. Wouldn't that make the character sprites places behind the bright pillars by default, or did you place them in top just as an example?
Thanks!
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Charles Mc Donald explained you how to fake transparency by using complex sprite priorities but that has nothing to do with the hilight / shadow effect
Hilight / Shadow permit to increase or decrease color intensity on specific part of plan or sprite.
You can find more infos about hilight / shadow here :
http://www.sega-16.com/forum/showthread ... and-Shadow
Hilight / Shadow permit to increase or decrease color intensity on specific part of plan or sprite.
You can find more infos about hilight / shadow here :
http://www.sega-16.com/forum/showthread ... and-Shadow
Last edited by Stef on Wed Sep 26, 2012 7:56 am, edited 1 time in total.
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
That wasn't me...Stef wrote:Chilly Willy explained you how to fake transparency by using complex sprite priorities but that has nothing to do with the hilight / shadow effect
Hilight / Shadow permit to increase or decrease color intensity on specific part of plan or sprite.
You can find more infos about hilight / shadow here :
http://www.sega-16.com/forum/showthread ... and-Shadow
-
- Very interested
- Posts: 292
- Joined: Sat Apr 21, 2007 1:14 am
Re: Opacity
No, but if you want to be creative you can combine shadow/highlight mode with this technique.Does this require shadow/hilight to be enabled?
One thing about the VDP is that it won't draw sprite pixels into a location where an earlier sprite was drawn. This effectively reverses the apparent drawing order for sprites. So early sprite entries in the list are the "topmost" sprites, and later entries are the "bottommost" sprites that will appear to be overlapped by earlier sprites.Also, the character sprites need to be a lower priority early in the list, and the bright pillars are high priority later in the list. Wouldn't that make the character sprites places behind the bright pillars by default, or did you place them in top just as an example?
In this case of the example, the character sprites are early in the last and drawn completely. The pillar sprites are defined later and are only partially drawn into the areas that the character sprites do not occupy.
Chilly, this was your chance to claim some credit! >_>
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
Re: Opacity
Charles MacDonald wrote:Chilly, this was your chance to claim some credit! >_>
I've got plenty I can claim... no need to be greedy.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Oh yeah sorry, it was Charles Mc DonaldChilly Willy wrote:That wasn't me...Stef wrote:Chilly Willy explained you how to fake transparency by using complex sprite priorities but that has nothing to do with the hilight / shadow effect
Hilight / Shadow permit to increase or decrease color intensity on specific part of plan or sprite.
You can find more infos about hilight / shadow here :
http://www.sega-16.com/forum/showthread ... and-Shadow
I guess i did that mistake because your names starts with the same letters
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
I thought the castlevania spinning blades trick was pretty nifty! You could create some interesting shapes.elusive wrote: What are some of the creative things that can be done with shadow/hilight?
Thanks!
Whenever I get to it, I'd like to pull off a silhouette effect for Goplanes when flying behind big patches of clouds.
-
- Very interested
- Posts: 292
- Joined: Sat Apr 21, 2007 1:14 am
Oops, the devil is in the details.elusive wrote:Alright. I got it to work I did have to make the the background layer tiles at a high priority as well, otherwise everything you explained was perfect.
As you've probably seen, background tiles with low priority are shown at half brightness and tiles with high priority have normal brightness. This applies to blank tiles too. So you can fill plane A with blank tiles and then set the priority bits to make rectangular areas on plane B that are darker, such as if you wanted a text box printed on plane A to have semi-transparency against plane B.What are some of the creative things that can be done with shadow/hilight?
Or, you can take that rectangular area and then skew it with line scrolling and column scrolling into other shapes. Castlevania does this in one of the later levels to make it look like light is coming in through windows into a hallway, and as you move left to right the angle of the beams tilt accordingly. They are just changing the line-scroll values to move the mix of blank low and high priority tiles around.
You don't have to scroll though. When you open up a skylight in Ranger-X's cave level, they set blank tiles underneath it to high priority so it looks like light is filtering in from above. It looks realistic since the sprites get lighter when they step into it too.
Since shadow and highlight pixels effectively double the number of on-screen colors, some games use a mix of background graphics and shadow/highlight sprites to show static images with more colors than normally possible. You can see this on the Sub-Terrania and Red Zone title screens, as well as the Traveller's Tales logo in Sonic 3D Blast. It's harder to apply this to moving graphics, but doable.
I think the more traditional uses are things like shadows underneath the characters, or highlights against the background like the light you'd get from shining a spotlight at something. Since you can mix shadow/highlight pixels with regular colors in a sprite, you could shade the cockpit glass of a plane or make a character's cape semi-translucent too. I suppose there are a lot of applications.
Personally I was always bummed more games didn't use this mode effectively. I guess homebrew developers can pick up where Sega left off and put it to good use.
-
- Very interested
- Posts: 211
- Joined: Sat Apr 19, 2008 10:58 am
- Location: Frankfurt, Germany
- Contact:
Re: Opacity
Great post! Thank you for this explanation (I have to admit my mind was a little blown afterwards )Charles MacDonald wrote:Here's how it works. I'll use Jackie Chan's Action Kung Fu as it has a clear example:How can this be achieved? I thought I saw something a while back about layers and sprite priorities and messing with that to get a silhouette type of opacity, but I haven't been able to do that.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
I agree The problem is that HS mode add some heavy constraints on priority, you cannot use them freely anymore. Still for almost games HS mode could be used. A good example is the fighter's shadow in mortal kombat 1 game. I really wonder why no more games used HS mode just for that very basic case.Charles MacDonald wrote: Personally I was always bummed more games didn't use this mode effectively. I guess homebrew developers can pick up where Sega left off and put it to good use.