Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Basic Light Code

vfrontiers
Contributor
I cannot seem to get what I want out of the basic light code as presented in the GDL Manual...
All is fine... until I want intensity to be greater than 100... The light simply does not shine at all..

In backward engineering from a recessed can by graphisoft, they divide each color by 255... But that produces nothing for me either (no light)

All GS lights support intensity values to 200...

(the reason this is important is the way ENSCAPE handles lighting)

here's my code...(some transformations are irrelevant)

!!!--------- Duane's Basic Light 1 ----------
lint = gs_light_intensity/100
zz = 1
if gs_light_intensity > .00000000001 THEN
	ADDX A/2
	ADDY .29*B
	roty 90
	addx 1"
	rotx Lt1X
	roty Lt1Y

	if SR then	lin_ 0,0,0,1',0,0



	LIGHT (gs_color_red/zz)*lint, (gs_color_green/zz)*lint, (gs_color_blue/zz)*lint, 1,
	a/4, alpha, beta, angle_falloff,
	distance_1, distance_2,
	distance_falloff 

Any advice is welcome....
For now, I can live with 100max... but am curious why/how gs lights achieve more.
Duane
Visual Frontiers
AC22 6021:|: AC24 4007:|: Enscape3:|:TwinMotion
DellXPS 4.7ghz i7:|: 8gb GPU 1070ti
6 REPLIES 6

Barry Kelly
Moderator
The RGB colours need to be values between 0.0 & 1.0
The pen colour can be up to 255, so you divide the pen colour by 255 to get the 0.00 - 1.0 value.
I think your code needs to be this...

color_red = Red_pen_value/255
color_green = Green_pen_value/255
color_blue = Blue_pen_value/255

LIGHT lint*color_red, lint*color_green, lint*color_blue, 1,
a/4, alpha, beta, angle_falloff,
distance_1, distance_2,
distance_falloff


Barry.

One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

vfrontiers
Contributor
Thanks Barry...

That is the logic I followed...

I used my zz as a mulitiplier (or DIVIDER, in this case)... When zz=255 no light showed in the scene..

I'll keep testing...
Duane
Visual Frontiers
AC22 6021:|: AC24 4007:|: Enscape3:|:TwinMotion
DellXPS 4.7ghz i7:|: 8gb GPU 1070ti

Barry Kelly
Moderator
vfrontiers wrote:
When zz=255 no light showed in the scene..
So long as gs_color_red, gs_color_green, gs_color_blue are all in the range 0 to 255, then it should work fine I would have thought.
If all three colours are 0 (zero) the light would be black and all 3 colours at 255 would be white.
Any colour values below zero or above 255 would result in an incorrect light colour (RGB).

I just tested with this and it worked fine.

zz = 255
lint = gs_light_intensity/100

LIGHT (255/zz)*lint, (255/zz)*lint, (255/zz)*lint,
1, ! shadow on
1.0, ! radius
45.0, 60.0, ! angle1, angle2
0.3, ! angle_falloff
1.0, 10.0, ! distance1, distance2
0.2 ! distance_falloff


Of course the object has to have a subtype of 'Light' and you can only see it in a render with the light option turned on.

Barry.

One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

vfrontiers
Contributor
I guess my light was technically working... now the issue (which I'm not really going to pursue) is why Graphisoft lights work up to a 200% brightness... and I can only achieve up to 100%.

Again, this is only an issue because of ENSCAPE... It's lighting model seems to require lights above 100% to be effective.


Thanks for listening!
Duane
Visual Frontiers
AC22 6021:|: AC24 4007:|: Enscape3:|:TwinMotion
DellXPS 4.7ghz i7:|: 8gb GPU 1070ti

Peter Baksa
Graphisoft
Graphisoft
Hi vfrontiers,

The LIGHT command can only use RGB values between 0-1. The GS light objects calculate rgb using an intensity parameter. For the rgb values any intensity above 100 is used as 100 in the calculation.
100-200 is used only in ADDITIONAL_DATA for the c4d engine, independently from the rgb color.
Here is some information about the c4d parameters: http://gdl.graphisoft.com/gdl_other_docs/channel-details
Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

vfrontiers
Contributor
Thank you Peter... I figured there was some SECRET somewhere...

I guess the "good news" is that ENSCAPE sees and allows that parameter to be over 100 and creates more light accordingly...

I'll have to look at that code and see if I can use it in my lights
Duane
Visual Frontiers
AC22 6021:|: AC24 4007:|: Enscape3:|:TwinMotion
DellXPS 4.7ghz i7:|: 8gb GPU 1070ti

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!