News:

Welcome to RetroCoders Community

Main Menu

Tessellation, 2-colour layering version

Started by CharlieJV, May 10, 2023, 03:10 AM

Previous topic - Next topic

CharlieJV

In the Tessellation with randomly generated graphics characters thread, that program demonstrates the use of _LETCHR$ to create a custom graphics character.

In this modified version of the application, we make use of PutString$ to layer two graphics characters with different colours.



You cannot view this attachment.
You cannot view this attachment.
You cannot view this attachment.   

CharlieJV


ZXDunny

You know what I did then :)



Very similar to the first, but this adds a "DO 2" loop (rather than creating and holding two textures) and avoids the CLS between loops. It takes advantage of the TRANSPARENT argument for PRINT to overlay one texture on top of another with transparency on the un-set pixels.

Similar effect. I just noticed I don't check for two instances of the same INK colour, but with a palette of 256 colours to choose from I'm not too worried :)

CharlieJV

Quote from: ZXDunny on May 10, 2023, 10:03 AMYou know what I did then :)



Very similar to the first, but this adds a "DO 2" loop (rather than creating and holding two textures) and avoids the CLS between loops. It takes advantage of the TRANSPARENT argument for PRINT to overlay one texture on top of another with transparency on the un-set pixels.

Similar effect. I just noticed I don't check for two instances of the same INK colour, but with a palette of 256 colours to choose from I'm not too worried :)

That's good stuff.  Transparency: nice, as in I wish!

ZXDunny

Quote from: CharlieJV on May 10, 2023, 12:40 PMThat's good stuff.  Transparency: nice, as in I wish!

You already have it, or you wouldn't be able to see one pattern underneath the other :)

CharlieJV

#5
Quote from: ZXDunny on May 10, 2023, 02:01 PM
Quote from: CharlieJV on May 10, 2023, 12:40 PMThat's good stuff.  Transparency: nice, as in I wish!

You already have it, or you wouldn't be able to see one pattern underneath the other :)

That isn't transparency.

That is "image smoothing": https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled

Here is an example with smoothing turned off:

You cannot view this attachment. 
You cannot view this attachment.

ZXDunny

Not quite what I meant :)

Transparency is where unset pixels (".") are not painted, but set pixels ("X") are painted. You can see one pattern beneath the other in your examples. Unrelated to the bilinear filtering applied in the scaling!

In SpecBAS, fonts are either mono or colour. If Mono, then any byte in the character that is non-zero is painted in the current INK, and any zero byte is painted in the current PAPER. As the current PAPER is black, it obliterates whatever is underneath on the second pass.

Setting TRANSPARENT 1 enabled transparency - any zero byte is NOT painted, any non-zero IS painted. So you can see the underlying pattern from the first pass through the holes in the second pass :)

CharlieJV

Oh yeah, I should have mentioned. 

When creating custom characters with _LETCHR$, an "X" means pixel on, and a "." really means "don't turn this pixel on" (as in leave it be).  I've made a mistake in a few places saying that "." is set pixel off, when that's not the case.

Anyhoo...

Where a character's pixel is not turned on, then wherever that part of the character appears on the screen, the state of existing pixels will be switched to the colour of the pixel for the character where the character's pixels are "on", but the state of an existing pixels on the screen where the character's pixels are set to "not on" will be left as they are.

So kind of like transparency in the sense of 0% transparent or 100% transparent, but there is no transparency value between those two extremes.


CharlieJV

Quote from: ZXDunny on May 10, 2023, 03:29 PMNot quite what I meant :)

Transparency is where unset pixels (".") are not painted, but set pixels ("X") are painted. You can see one pattern beneath the other in your examples. Unrelated to the bilinear filtering applied in the scaling!

In SpecBAS, fonts are either mono or colour. If Mono, then any byte in the character that is non-zero is painted in the current INK, and any zero byte is painted in the current PAPER. As the current PAPER is black, it obliterates whatever is underneath on the second pass.

Setting TRANSPARENT 1 enabled transparency - any zero byte is NOT painted, any non-zero IS painted. So you can see the underlying pattern from the first pass through the holes in the second pass :)

Ah, okay.  Your transparency is the same as mine: 0% or 100%, no in between.

For some reason, I thought your transparency was like the "opacity" attribute in HTML/CSS, allowing for anything between 0% and 100% inclusively, which is something that also exist, I think, in QB64pe (via "alpha" blending, if I understand it right.)

ZXDunny

Quote from: CharlieJV on May 10, 2023, 03:42 PMAh, okay.  Your transparency is the same as mine: 0% or 100%, no in between.

For some reason, I thought your transparency was like the "opacity" attribute in HTML/CSS, allowing for anything between 0% and 100% inclusively, which is something that also exist, I think, in QB64pe (via "alpha" blending, if I understand it right.)

I do have alpha blending for 32bpp windows, but that's another story :)

Transparency for mono fonts - where each pixel is either on or off - is as you have yours, but colour fonts where each pixel is a palette value from 0 to 255, can use transparency as a colour key, where you decide which palette entry is transparent.

But anyway, we're on the same page now. I'm working up a little spinning cube demo now, I'll post it when it's done :)

CharlieJV

Quote from: ZXDunny on May 10, 2023, 04:03 PM
Quote from: CharlieJV on May 10, 2023, 03:42 PMAh, okay.  Your transparency is the same as mine: 0% or 100%, no in between.

For some reason, I thought your transparency was like the "opacity" attribute in HTML/CSS, allowing for anything between 0% and 100% inclusively, which is something that also exist, I think, in QB64pe (via "alpha" blending, if I understand it right.)

I do have alpha blending for 32bpp windows, but that's another story :)

Transparency for mono fonts - where each pixel is either on or off - is as you have yours, but colour fonts where each pixel is a palette value from 0 to 255, can use transparency as a colour key, where you decide which palette entry is transparent.

But anyway, we're on the same page now. I'm working up a little spinning cube demo now, I'll post it when it's done :)

I get there at some point, but oh Lord, all of the rabbit holes I run through along the way ...

Like I always say: to look at me, you may think the hamster is dead, but the wheel is always spinning.