How do you make black as a solid color ? So that the black color will not be transparent for this case :
I am placing a cube built from 6 square polygon to make a cube effect, what is the best way to acheive this ? as for now 1 of the polygon seems to always stay transparent ! I will post an example later !
Edit : my question wasnt clear enough
How do you make black as a solid color ?
-
- Posts: 131
- Joined: Sat Sep 19, 2015 12:27 am
Re: How do you make black as a solid color ?
If I had to guess, I'd say the problem you're encountering is with depth testing. You might want to look at the DepthTestExample sample project to see what I mean. Using the DepthTest module will probably make things look better . It layers things based on their Z position instead of their input pin.
-
- Posts: 131
- Joined: Sat Sep 19, 2015 12:27 am
Re: How do you make black as a solid color ?
You were right about this but using depthtest cause really glitchy result ! I attached my example for better understanding.
Option 1 : Without using depthtest this will result some object to look like transparent
Option 2 : Using depthtest will look glitchy
Is there any other option available ? or maybe i am doing it wrong ?
Option 1 : Without using depthtest this will result some object to look like transparent
Option 2 : Using depthtest will look glitchy
Is there any other option available ? or maybe i am doing it wrong ?
- Attachments
-
- Problem Example.magic
- (1.59 KiB) Downloaded 370 times
Re: How do you make black as a solid color ?
When trying to recreate I also see something I wouldn't expect with DepthTest on polys.
Though it does give a nice sparkly effect when radially blurred.
Though it does give a nice sparkly effect when radially blurred.
Re: How do you make black as a solid color ?
The problem here is a phenomenon known as "z-fighting". See https://en.wikipedia.org/wiki/Z-fighting. If two polygons occupy exactly the same position in space, the renderer doesn't know how to render them.Option 2 : Using depthtest will look glitchy
This can happen in pretty much any program that does 3D rendering. To help prevent it, fancy algorithms can be used, but the tradeoff is that the rendering won't be as fast.
An easy solution is to translate one of the polygons just a tiny little bit, for example, .0001 in the Z direction, so that it is in front of (or behind) the other one. Then the problem goes away .
Hah, that's interesting. I'm not sure if I've ever seen it used as an intentional effect, but it can work I guess.Though it does give a nice sparkly effect when radially blurred.
-
- Posts: 131
- Joined: Sat Sep 19, 2015 12:27 am
Re: How do you make black as a solid color ?
Hey Eric ! This is just amazing ! This information should be widespread as this problem will for sure occur for other people tho !Eric wrote:The problem here is a phenomenon known as "z-fighting". See https://en.wikipedia.org/wiki/Z-fighting. If two polygons occupy exactly the same position in space, the renderer doesn't know how to render them.Option 2 : Using depthtest will look glitchy
This can happen in pretty much any program that does 3D rendering. To help prevent it, fancy algorithms can be used, but the tradeoff is that the rendering won't be as fast.
An easy solution is to translate one of the polygons just a tiny little bit, for example, .0001 in the Z direction, so that it is in front of (or behind) the other one. Then the problem goes away .
Hah, that's interesting. I'm not sure if I've ever seen it used as an intentional effect, but it can work I guess.Though it does give a nice sparkly effect when radially blurred.
Btw : this fixed everything and now opens new doors for me !
Re: How do you make black as a solid color ?
I'm sure most folks could manage a cube on their own but with inspiration from Tanooki and expertise from Eric a little sharing is appropriate.
This provides an opportunity for me to make a feature request. To use a shader as a square texture one must scale it. Better would be an option to set the render resolution (which might have been asked for before for different reasons) which would allow the effect to render at the correct aspect ratio. Especially prevalent when dealing with circular sources.Re: How do you make black as a solid color ?
Happy to helpHey Eric ! This is just amazing ! This information should be widespread as this problem will for sure occur for other people tho !
Btw : this fixed everything and now opens new doors for me !
That's what the Resolution module is for. It renders its input(s) at the specified resolution. It actually forces a temporary change in the resolution of the output (as opposed to rendering at the output resolution and then re-scaling), so if you specify a smaller resolution than the output, it will render faster. Cool eh?Better would be an option to set the render resolution (which might have been asked for before for different reasons) which would allow the effect to render at the correct aspect ratio. Especially prevalent when dealing with circular sources.
For an example, you can open the Effects2DExamples sample project and check out the Resolution tab.
For your purpose you could do GLSLShader --> Resolution --> CUBE, and set the Resolution to 720x720 or something like that.
Re: How do you make black as a solid color ?
Indeed. Thanks. Twas in the recesses of memory.