Question about coloring and lightning

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

Question about coloring and lightning

Joel Bodenmann
Hello Folk,

I am new to OpenSCAD but I already love it! :D
I have just a little problem with the coloring of objects. I made a cube and cut three cylinders out of it, for bearings. Now I tried to color out the bearing holes. I attached two screen shots.
As you see, one side is not colored and has this fancy lightning so you can see the hole. The side I tried to color red, dosen't have that fancy lightning which makes it hard to see the hole correctly.
I also tried to play with the alpha value - no changes at all.

Can anybody help here?


My code: 



$fn=200;


height = 10;


difference() {

cube([50,50,50]);

translate([25,25,-1]) cylinder(h=52, r=7);

translate([25,25,-1]) cylinder(h=height, r=19);

color([255,0,0,255]) translate([25,25,51-height]) cylinder(h=height, r=19);

}




Kind Regards,

Joel Bodenmann

2012-08-22-104822_1440x900_scrot.png (116K) Download Attachment
2012-08-22-104834_1440x900_scrot.png (118K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Question about coloring and lightning

nophead
I think it is because you have used 255. Color values are 0 -1.0.

On 22 August 2012 10:14, Joel Bodenmann <[hidden email]> wrote:
Hello Folk,

I am new to OpenSCAD but I already love it! :D
I have just a little problem with the coloring of objects. I made a cube and cut three cylinders out of it, for bearings. Now I tried to color out the bearing holes. I attached two screen shots.
As you see, one side is not colored and has this fancy lightning so you can see the hole. The side I tried to color red, dosen't have that fancy lightning which makes it hard to see the hole correctly.
I also tried to play with the alpha value - no changes at all.

Can anybody help here?


My code: 



$fn=200;


height = 10;


difference() {

cube([50,50,50]);

translate([25,25,-1]) cylinder(h=52, r=7);

translate([25,25,-1]) cylinder(h=height, r=19);

color([255,0,0,255]) translate([25,25,51-height]) cylinder(h=height, r=19);

}




Kind Regards,

Joel Bodenmann

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566

Reply | Threaded
Open this post in threaded view
|

Re: Question about coloring and lightning

nophead
Yes it works as you expected with color([1,0,0]) or simply color("red").

I hadn't realised before that surfaces take on the colour of the negative objects that form them.


On 22 August 2012 13:25, nop head <[hidden email]> wrote:
I think it is because you have used 255. Color values are 0 -1.0.

On 22 August 2012 10:14, Joel Bodenmann <[hidden email]> wrote:
Hello Folk,

I am new to OpenSCAD but I already love it! :D
I have just a little problem with the coloring of objects. I made a cube and cut three cylinders out of it, for bearings. Now I tried to color out the bearing holes. I attached two screen shots.
As you see, one side is not colored and has this fancy lightning so you can see the hole. The side I tried to color red, dosen't have that fancy lightning which makes it hard to see the hole correctly.
I also tried to play with the alpha value - no changes at all.

Can anybody help here?


My code: 



$fn=200;


height = 10;


difference() {

cube([50,50,50]);

translate([25,25,-1]) cylinder(h=52, r=7);

translate([25,25,-1]) cylinder(h=height, r=19);

color([255,0,0,255]) translate([25,25,51-height]) cylinder(h=height, r=19);

}




Kind Regards,

Joel Bodenmann

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


Reply | Threaded
Open this post in threaded view
|

Re: Question about coloring and lightning

Robert H. Morrison
In reply to this post by Joel Bodenmann
Hi Joel,

http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations

$fn=200;
height = 10;

difference() {
    cube([50,50,50]);
    translate([25,25,-1])
        cylinder(h=52, r=7);
    translate([25,25,-1])
        cylinder(h=height, r=19);
    color([1,0,0,1])
        translate([25,25,51-height])
            cylinder(h=height, r=19);
}

You can only use values between 0 and 1!

Best regards,
   __            _ _ _
  /  )      /   ' ) ) )
 /--<  ____/_    / / / __,_  __  o _   ________
/___/_(_) /_)   / ' (_(_) (_/ (_<_/_)_(_) / / <_
                                 ,,,
                               (o o)
--- --- --- --- --- --- ---oOo--(_)--oOo--- --- --- --- --- --- ---
                       "Luke, use the source!"
--- --- --- --- --- --- ---oOo-------oOo--- --- --- --- --- --- ---

Bob Morrison
BSEE, 78, Ga Tech



From: "[hidden email]" <[hidden email]>
To: [hidden email]
Sent: Wednesday, August 22, 2012 2:13 PM
Subject: OpenSCAD Digest, Vol 33, Issue 27

Send OpenSCAD mailing list submissions to
    [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
    http://rocklinux.net/mailman/listinfo/openscad
or, via email, send a message with subject or body 'help' to
    [hidden email]

You can reach the person managing the list at
    [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of OpenSCAD digest..."


Today's Topics:

  1. Question about coloring and lightning (Joel Bodenmann)


----------------------------------------------------------------------

Message: 1
Date: Wed, 22 Aug 2012 11:14:38 +0200
From: Joel Bodenmann <[hidden email]>
Subject: [OpenSCAD] Question about coloring and lightning
To: [hidden email]
Message-ID: <[hidden email]>
Content-Type: text/plain; charset="iso-8859-1"

Hello Folk,

I am new to OpenSCAD but I already love it! :D
I have just a little problem with the coloring of objects. I made a cube
and cut three cylinders out of it, for bearings. Now I tried to color
out the bearing holes. I attached two screen shots.
As you see, one side is not colored and has this fancy lightning so you
can see the hole. The side I tried to color red, dosen't have that fancy
lightning which makes it hard to see the hole correctly.
I also tried to play with the alpha value - no changes at all.

Can anybody help here?


My code:



$fn=200;


height = 10;


difference() {

cube([50,50,50]);

translate([25,25,-1]) cylinder(h=52, r=7);

translate([25,25,-1]) cylinder(h=height, r=19);

color([255,0,0,255]) translate([25,25,51-height]) cylinder(h=height, r=19);

}




Kind Regards,

Joel Bodenmann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rocklinux.net/pipermail/openscad/attachments/20120822/847304bf/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2012-08-22-104822_1440x900_scrot.png
Type: image/png
Size: 87953 bytes
Desc: not available
Url : http://rocklinux.net/pipermail/openscad/attachments/20120822/847304bf/2012-08-22-104822_1440x900_scrot.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2012-08-22-104834_1440x900_scrot.png
Type: image/png
Size: 90088 bytes
Desc: not available
Url : http://rocklinux.net/pipermail/openscad/attachments/20120822/847304bf/2012-08-22-104834_1440x900_scrot.png

------------------------------

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad


End of OpenSCAD Digest, Vol 33, Issue 27
****************************************