color() thing

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

color() thing

crunchysteve
Interesting issue with color() function on Mac OS since late december nightly
builds. M1 Macbook Air (Big Sur, of course, seeing as it's an M1, V.11.2)

If I place coloured text overlays at the beginning of a document (where I
always have in the past), the colour gets overidden by the later components
of the drawing where the two intersect. This wasn't a problem with 2019.05
and back. My first appearance was 2020.12 and screenshots from 2021.1.2

Placing the coloured text at the end of the document solves the problem, so
I'm guessing this is down to some streamlining of the code? I'm not overly
bothered by it, as it's fixed by an easy change of operation convention, but
thought it best to point it out, in case it's down to something overlooked
and serious.

Screeners attached
colorCallsAtFront.png
<http://forum.openscad.org/file/t3026/colorCallsAtFront.png>  
ColorCallsAtRear.png
<http://forum.openscad.org/file/t3026/ColorCallsAtRear.png>  

Cheers,
Steve



-----
Make things, travel and tell stories.
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Make things, travel and tell stories.
Reply | Threaded
Open this post in threaded view
|

Re: color() thing

thehans
Can you post the script or a simplified version of it which reproduces the issue?

It looks like the issue has to do with your 2d text sharing the same face as other 2D objects (even if those are negative, difference'd objects) which is simply one of the limitations of how OpenCSG renders aka Z-fighting.
But this was also the case for the 2019.05 release, so I don't believe the same script would have worked there either.

Another way to fix it would be to give your 2D objects real thickness with linear_extrude, and then translate the text along positive Z to actually be above the other geometry.



On Sat, Jan 2, 2021 at 9:39 PM crunchysteve <[hidden email]> wrote:
Interesting issue with color() function on Mac OS since late december nightly
builds. M1 Macbook Air (Big Sur, of course, seeing as it's an M1, V.11.2)

If I place coloured text overlays at the beginning of a document (where I
always have in the past), the colour gets overidden by the later components
of the drawing where the two intersect. This wasn't a problem with 2019.05
and back. My first appearance was 2020.12 and screenshots from 2021.1.2

Placing the coloured text at the end of the document solves the problem, so
I'm guessing this is down to some streamlining of the code? I'm not overly
bothered by it, as it's fixed by an easy change of operation convention, but
thought it best to point it out, in case it's down to something overlooked
and serious.

Screeners attached
colorCallsAtFront.png
<http://forum.openscad.org/file/t3026/colorCallsAtFront.png
ColorCallsAtRear.png
<http://forum.openscad.org/file/t3026/ColorCallsAtRear.png

Cheers,
Steve



-----
Make things, travel and tell stories.
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: color() thing

MichaelAtOz'

You can Z-translate 2D.

 

translate([0,0,1])

  color("black")

    text("before");

difference() {

  circle(r=20);

  square(30,true);

}

translate([0,11])

  color("black")

    text("after");

 

It even renders.

 

 


From: Discuss [mailto:[hidden email]] On Behalf Of Hans L
Sent: Sun, 3 Jan 2021 15:09
To: OpenSCAD general discussion
Subject: Re: [OpenSCAD] color() thing

 

Can you post the script or a simplified version of it which reproduces the issue?

 

It looks like the issue has to do with your 2d text sharing the same face as other 2D objects (even if those are negative, difference'd objects) which is simply one of the limitations of how OpenCSG renders aka Z-fighting.

But this was also the case for the 2019.05 release, so I don't believe the same script would have worked there either.

 

Another way to fix it would be to give your 2D objects real thickness with linear_extrude, and then translate the text along positive Z to actually be above the other geometry.

 

 

 

On Sat, Jan 2, 2021 at 9:39 PM crunchysteve <[hidden email]> wrote:

Interesting issue with color() function on Mac OS since late december nightly
builds. M1 Macbook Air (Big Sur, of course, seeing as it's an M1, V.11.2)

If I place coloured text overlays at the beginning of a document (where I
always have in the past), the colour gets overidden by the later components
of the drawing where the two intersect. This wasn't a problem with 2019.05
and back. My first appearance was 2020.12 and screenshots from 2021.1.2

Placing the coloured text at the end of the document solves the problem, so
I'm guessing this is down to some streamlining of the code? I'm not overly
bothered by it, as it's fixed by an easy change of operation convention, but
thought it best to point it out, in case it's down to something overlooked
and serious.

Screeners attached
colorCallsAtFront.png
<http://forum.openscad.org/file/t3026/colorCallsAtFront.png
ColorCallsAtRear.png
<http://forum.openscad.org/file/t3026/ColorCallsAtRear.png

Cheers,
Steve



-----
Make things, travel and tell stories.
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


Virus-free. www.avg.com

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: color() thing

crunchysteve
In reply to this post by thehans
The script is visible in the screenshots but it's this for the text colour
being overridden...
osRad = 38;

color("black"){
translate([-200,200]) text(text="Chambered Headless Bass Body");
translate([0,80]) text(text="Upper Chamber");
translate([-10,115]) text(text="Upper Sound Hole");
translate([70,0]) text(text="Solid spine for Set Neck");
translate([0,-85]) text(text="Lower Chamber");
translate([235,-102]) text(text="Lower Sound Hole");
translate([-20,-130]) text(text="Control Panel");
}

//mirror([0,1,0]){
difference(){
    shape();
    difference(){
        offset(r=-4.5) shape();
        translate([-120,0]) square([63,190]);
    }
}

difference(){
    offset(r=-25) shape();
    offset(r=-26) shape();
}

difference(){
    offset(r=-52) shape();
    offset(r=-53) shape();
}

difference(){
    offset(r=-80) shape();
    offset(r=-81) shape();
}

difference(){
    offset(r=-110) shape();
    offset(r=-111) shape();
}

difference(){
    translate([238,-98]) circle(28);
    translate([238,-98]) circle(26);
}
translate([-90,-60]) square([363,1]);
translate([-90,59]) square([425,1]);
translate([-1,-70]) square([1,140]);

translate([-15,-15]) scale(1.2) difference(){
    boltHole();
    offset(r=-2) boltHole();
}
//}

module shape(){
    offset(r=osRad) offset(r=-osRad) offset(r=-osRad) offset(r=osRad){
        difference(){
            circle(190);
            translate([-195,-195]) square([195,390]);
        }
        difference(){
            scale([0.6,1]) circle(190);
            translate([-120,-80]) square([60,160]);
        }
        difference(){
            translate([255,0]) scale([0.6,1]) circle(147);
            translate([255,-150]) square([280,150]);
        }
        translate([255,-114]) circle(31);
        translate([255,-112]) square([35,5]);
        translate([255,-33]) square([88,33]);
    }
    offset(r=osRad/10) offset(r=-osRad/10){
        translate([255,-33]) square([88,33]);
    }
}

module boltHole(){
    polygon([[-20,140],[50,130],[55,120],[120,100],[45,110],[40,120]]);
}

...and this for it not...
osRad = 38;

//mirror([0,1,0]){
difference(){
    shape();
    difference(){
        offset(r=-4.5) shape();
        translate([-120,0]) square([63,190]);
    }
}

difference(){
    offset(r=-25) shape();
    offset(r=-26) shape();
}

difference(){
    offset(r=-52) shape();
    offset(r=-53) shape();
}

difference(){
    offset(r=-80) shape();
    offset(r=-81) shape();
}

difference(){
    offset(r=-110) shape();
    offset(r=-111) shape();
}

difference(){
    translate([238,-98]) circle(28);
    translate([238,-98]) circle(26);
}
translate([-90,-60]) square([363,1]);
translate([-90,59]) square([425,1]);
translate([-1,-70]) square([1,140]);

translate([-15,-15]) scale(1.2) difference(){
    boltHole();
    offset(r=-2) boltHole();
}
//}

module shape(){
    offset(r=osRad) offset(r=-osRad) offset(r=-osRad) offset(r=osRad){
        difference(){
            circle(190);
            translate([-195,-195]) square([195,390]);
        }
        difference(){
            scale([0.6,1]) circle(190);
            translate([-120,-80]) square([60,160]);
        }
        difference(){
            translate([255,0]) scale([0.6,1]) circle(147);
            translate([255,-150]) square([280,150]);
        }
        translate([255,-114]) circle(31);
        translate([255,-112]) square([35,5]);
        translate([255,-33]) square([88,33]);
    }
    offset(r=osRad/10) offset(r=-osRad/10){
        translate([255,-33]) square([88,33]);
    }
}

module boltHole(){
    polygon([[-20,140],[50,130],[55,120],[120,100],[45,110],[40,120]]);
}

color("black"){
translate([-200,200]) text(text="Chambered Headless Bass Body");
translate([0,80]) text(text="Upper Chamber");
translate([-10,115]) text(text="Upper Sound Hole");
translate([70,0]) text(text="Solid spine for Set Neck");
translate([0,-85]) text(text="Lower Chamber");
translate([235,-102]) text(text="Lower Sound Hole");
translate([-20,-130]) text(text="Control Panel");
}



-----
Make things, travel and tell stories.
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Make things, travel and tell stories.
Reply | Threaded
Open this post in threaded view
|

Re: color() thing

MichaelAtOz
Administrator

Steve,

 

This is not a bug.

The visual result of Z-fighting* is indeterminate and will depend on many things.

* https://en.wikipedia.org/wiki/Z-fighting

 

translate([0,0])

  color("black")

    text("before");

difference() {

  circle(r=20);

  square(30,true);

}

translate([0,11])

  color("black")

    text("after");

 

When looked at via view/top, looks conclusively like a bug.

 

Viewed differently;

Shows Z-fighting even in the 'after' text.

 

Try my suggestion

 

translate([0,0,1])

  color("black")

    text("before");

difference() {

  circle(r=20);

  square(30,true);

}

translate([0,11,1])

  color("black")

    text("after");

 

 

> -----Original Message-----

> From: Discuss [mailto:[hidden email]] On Behalf Of crunchysteve

> Sent: Mon, 4 Jan 2021 00:35

> To: [hidden email]

> Subject: Re: [OpenSCAD] color() thing

>

> The script is visible in the screenshots but it's this for the text colour

> being overridden...

> osRad = 38;

>

> color("black"){

> translate([-200,200]) text(text="Chambered Headless Bass Body");

> translate([0,80]) text(text="Upper Chamber");

> translate([-10,115]) text(text="Upper Sound Hole");

> translate([70,0]) text(text="Solid spine for Set Neck");

> translate([0,-85]) text(text="Lower Chamber");

> translate([235,-102]) text(text="Lower Sound Hole");

> translate([-20,-130]) text(text="Control Panel");

> }

>

> //mirror([0,1,0]){

> difference(){

>     shape();

>     difference(){

>         offset(r=-4.5) shape();

>         translate([-120,0]) square([63,190]);

>     }

> }

>

> difference(){

>     offset(r=-25) shape();

>     offset(r=-26) shape();

> }

>

> difference(){

>     offset(r=-52) shape();

>     offset(r=-53) shape();

> }

>

> difference(){

>     offset(r=-80) shape();

>     offset(r=-81) shape();

> }

>

> difference(){

>     offset(r=-110) shape();

>     offset(r=-111) shape();

> }

>

> difference(){

>     translate([238,-98]) circle(28);

>     translate([238,-98]) circle(26);

> }

> translate([-90,-60]) square([363,1]);

> translate([-90,59]) square([425,1]);

> translate([-1,-70]) square([1,140]);

>

> translate([-15,-15]) scale(1.2) difference(){

>     boltHole();

>     offset(r=-2) boltHole();

> }

> //}

>

> module shape(){

>     offset(r=osRad) offset(r=-osRad) offset(r=-osRad) offset(r=osRad){

>         difference(){

>             circle(190);

>             translate([-195,-195]) square([195,390]);

>         }

>         difference(){

>             scale([0.6,1]) circle(190);

>             translate([-120,-80]) square([60,160]);

>         }

>         difference(){

>             translate([255,0]) scale([0.6,1]) circle(147);

>             translate([255,-150]) square([280,150]);

>         }

>         translate([255,-114]) circle(31);

>         translate([255,-112]) square([35,5]);

>         translate([255,-33]) square([88,33]);

>     }

>     offset(r=osRad/10) offset(r=-osRad/10){

>         translate([255,-33]) square([88,33]);

>     }

> }

>

> module boltHole(){

>     polygon([[-20,140],[50,130],[55,120],[120,100],[45,110],[40,120]]);

> }

>

> ...and this for it not...

> osRad = 38;

>

> //mirror([0,1,0]){

> difference(){

>     shape();

>     difference(){

>         offset(r=-4.5) shape();

>         translate([-120,0]) square([63,190]);

>     }

> }

>

> difference(){

>     offset(r=-25) shape();

>     offset(r=-26) shape();

> }

>

> difference(){

>     offset(r=-52) shape();

>     offset(r=-53) shape();

> }

>

> difference(){

>     offset(r=-80) shape();

>     offset(r=-81) shape();

> }

>

> difference(){

>     offset(r=-110) shape();

>     offset(r=-111) shape();

> }

>

> difference(){

>     translate([238,-98]) circle(28);

>     translate([238,-98]) circle(26);

> }

> translate([-90,-60]) square([363,1]);

> translate([-90,59]) square([425,1]);

> translate([-1,-70]) square([1,140]);

>

> translate([-15,-15]) scale(1.2) difference(){

>     boltHole();

>     offset(r=-2) boltHole();

> }

> //}

>

> module shape(){

>     offset(r=osRad) offset(r=-osRad) offset(r=-osRad) offset(r=osRad){

>         difference(){

>             circle(190);

>             translate([-195,-195]) square([195,390]);

>         }

>         difference(){

>             scale([0.6,1]) circle(190);

>             translate([-120,-80]) square([60,160]);

>         }

>         difference(){

>             translate([255,0]) scale([0.6,1]) circle(147);

>             translate([255,-150]) square([280,150]);

>         }

>         translate([255,-114]) circle(31);

>         translate([255,-112]) square([35,5]);

>         translate([255,-33]) square([88,33]);

>     }

>     offset(r=osRad/10) offset(r=-osRad/10){

>         translate([255,-33]) square([88,33]);

>     }

> }

>

> module boltHole(){

>     polygon([[-20,140],[50,130],[55,120],[120,100],[45,110],[40,120]]);

> }

>

> color("black"){

> translate([-200,200]) text(text="Chambered Headless Bass Body");

> translate([0,80]) text(text="Upper Chamber");

> translate([-10,115]) text(text="Upper Sound Hole");

> translate([70,0]) text(text="Solid spine for Set Neck");

> translate([0,-85]) text(text="Lower Chamber");

> translate([235,-102]) text(text="Lower Sound Hole");

> translate([-20,-130]) text(text="Control Panel");

> }

>

>

>

> -----

> Make things, travel and tell stories.

> --

> Sent from: http://forum.openscad.org/

>

> _______________________________________________

> OpenSCAD mailing list

> [hidden email]

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


Virus-free. www.avg.com

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...
* on the Forum, click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain;
to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.