Spot light parameters [color and inner spot]
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
-
martinezz123
- Posts: 103
- Joined: Wed Jan 22, 2020 5:04 am
Spot light parameters [color and inner spot]
Hi I'm trying to create some celling lights with the spot light feature.
However cant figure out what is the color format of the light and how the inner angle works (it seems to do nothing).
Any help?
However cant figure out what is the color format of the light and how the inner angle works (it seems to do nothing).
Any help?
- Attachments
-
- Clipboard01.jpg (18.84 KiB) Viewed 2638 times
- Kappes Buur
-

- Posts: 4201
- Joined: Thu Jul 17, 2003 12:19 am
- Graphics Processor: nVidia (Legacy GZDoom)
- Location: British Columbia, Canada
- Contact:
Re: Spot light parameters [color and inner spot]
Experiment a bit with the values of inner angles and outer angles, and see what happens:
inner 18
outer 48
outer 18
outer 9
One might think that the inner angle spot would be more pronounced and the outer angle
diminishing in intensity towards the edges, but it is not. I don't know why, I'm not a programmer.
And with the outer angle smaller than the inner angle you get a negative spotlight.
As to color values, that indeed is confusing me as well.
I find it best to stick to the string colour names, like red, blue, orange, etc
inner 18
outer 48
Spoiler:inner 18
outer 18
Spoiler:inner 18
outer 9
Spoiler:In general it seems that the inner angle is the spotlight and the outer angle is a diffused area.
One might think that the inner angle spot would be more pronounced and the outer angle
diminishing in intensity towards the edges, but it is not. I don't know why, I'm not a programmer.
And with the outer angle smaller than the inner angle you get a negative spotlight.
As to color values, that indeed is confusing me as well.
I find it best to stick to the string colour names, like red, blue, orange, etc
-
martinezz123
- Posts: 103
- Joined: Wed Jan 22, 2020 5:04 am
Re: Spot light parameters [color and inner spot]
Thank you. That's ecactly what confused me - the lack of inner glow spot. That's a pitty. I hope they will fix it.
Ok. didn't know I can use names.
Ok. didn't know I can use names.
Re: Spot light parameters [color and inner spot]
I haven't got to light a spotlight via ACS working.
This line,
SetThingSpecial(11,0,13553180,8,32,192,0);
And result is:

I think I can't use "orange", "white" there.
It should show up like this:

Color is defined on rgb... Like if defined in hexadecimal FFFFFF means white. FFFFFF as decimal is 16777215.
Here is an example. Or two. Use picture editing program like gimp to get the value of an color as a hex, then convert it with calculator:

This line,
SetThingSpecial(11,0,13553180,8,32,192,0);
And result is:

I think I can't use "orange", "white" there.
It should show up like this:

Color is defined on rgb... Like if defined in hexadecimal FFFFFF means white. FFFFFF as decimal is 16777215.
Here is an example. Or two. Use picture editing program like gimp to get the value of an color as a hex, then convert it with calculator:

- wildweasel
- Posts: 21706
- Joined: Tue Jul 15, 2003 7:33 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): A lot of them
- Graphics Processor: Not Listed
- Contact:
Re: Spot light parameters [color and inner spot]
Instead of entering in the decimal number (huh??), try entering the hexadecimal in quotes, like so:
Code: Select all
SetThingSpecial(11,0,"FF FF FF",8,32,192,0);Re: Spot light parameters [color and inner spot]
Doesn't work either.wildweasel wrote:Instead of entering in the decimal number (huh??), try entering the hexadecimal in quotes, like so:Code: Select all
SetThingSpecial(11,0,"FF FF FF",8,32,192,0);
Re: Spot light parameters [color and inner spot]
wildweasel: that won't work because that string just gets converted to an index on the script's string table.

By the way - in GZDoomBuilder/Ultimate Doom Builder, you can select a dynamic light thing and press K to use a colour picker. Much easier than figuring out the int value of a colour.
Code: Select all
// put this anywhere outside a script
function int MakeColor(int r, int g, int b)
{
return (b << 16) | (g << 8) | r;
}
// then in your script
SetThingSpecial(11, 0, MakeColor(255, 255, 255), 8, 32, 192, 0);

By the way - in GZDoomBuilder/Ultimate Doom Builder, you can select a dynamic light thing and press K to use a colour picker. Much easier than figuring out the int value of a colour.
Re: Spot light parameters [color and inner spot]
Thanks Nash. The light still looks the same. I don't get it.
That color picker is nice to know!
That color picker is nice to know!
Re: Spot light parameters [color and inner spot]
Jaska - what format is your map? Though this is just a wild guess, it could be that the value of the first arg is capped to 255 if you're using anything but UDMF.
A colour int value is very, very large. If it's being capped to 255, that would explain why the light appears red.
Try making a UDMF map and using my script and see what happens.
Alternate answer:
I am positive that that's not how you assign colours to dynamic light things using args. I think the first 3 available args for for the RGBs respectively, meaning:
A colour int value is very, very large. If it's being capped to 255, that would explain why the light appears red.
Try making a UDMF map and using my script and see what happens.
Alternate answer:
I am positive that that's not how you assign colours to dynamic light things using args. I think the first 3 available args for for the RGBs respectively, meaning:
Code: Select all
SetThingSpecial(11, 0, 255, 255, 255);
Re: Spot light parameters [color and inner spot]
Nash wrote:Jaska - what format is your map? Though this is just a wild guess, it could be that the value of the first arg is capped to 255 if you're using anything but UDMF.
A colour int value is very, very large. If it's being capped to 255, that would explain why the light appears red.
Try making a UDMF map and using my script and see what happens.
Alternate answer:
I am positive that that's not how you assign colours to dynamic light things using args. I think the first 3 available args for for the RGBs respectively, meaning:
Code: Select all
SetThingSpecial(11, 0, 255, 255, 255);
I'm using UDMF. Spotlight causes the problems. Normal dynamic light is ok like this:
SetThingSpecial(10,0,255,255,255,i,0); //light wall lights, i being used to rise the light level gradually, works just fine
SetThingSpecial(11,0,MakeColor(255, 255, 255),8,32,192,0); //light the spotlight, not working as intented
I've found a workaround using Thing_Deactivate() and Thing_Activate(). This requires all lights to be initialized at the start of the map in ACS. And it would be cool to change the color dynamically for a spotlight like in a loop. I'll test that, how it affects to the color.
Re: Spot light parameters [color and inner spot]
Well, when gradually rising the value.. Spotlight starts at dim red and keeps brightening up until you can't see the spotlights inner/outer angle.
Can't quite understand what's happening. Makes kind a sense why it's capped to red... If the value would be capped for some reason to 255 (FF) meaning only red values would be passed.. As we can see only red light. But why you can put very high values on "thing edit"? So they must behave differently. And why the spotlight inner angle seems to disappear slowly? If the argument would "leak" to another's space after 255 it would somehow make sense but now value can be so high, that it would override outer angle also, if you see what I'm trying to tell here.
I speeded count up by i += 10000 etc.
Code: Select all
script "lt" (void){
for(int i = 0; i < 100000000 ; i += 100) {
SetThingSpecial(289,0,i,8,32,192,0); //light the spotlight
delay(1);
HudMessage(s:"i = ",
d:i;
HUDMSG_PLAIN, 1, CR_RED, 0.1, 0.9, 5.0);
}
}I speeded count up by i += 10000 etc.
Re: Spot light parameters [color and inner spot]
Generated bytecode seems alright?.. not sure, I'm not an ACS expert
Additionally, it should not be capped to red, because in 0xRRGGBB the capped byte (0x0000FF) would be full blue, not full red.
Looks like some VM issue to me
Code: Select all
script "Test" OPEN {
SetThingSpecial(13,0,0xFF00,8,32,64,0);
}Code: Select all
8: script 65535, type = 1 (OPEN), flags = 0000, argc = 0
8: PUSH2BYTES 13, 0
11: PUSHNUMBER 65280
16: PUSH4BYTES 8, 32, 64, 0
21: SETTHINGSPECIAL
22: TERMINATELooks like some VM issue to me
- phantombeta
- Posts: 2188
- Joined: Thu May 02, 2013 1:27 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: Brazil
Re: Spot light parameters [color and inner spot]
The merged colour argument thing is UDMF-only. It gets converted to the normal colour args and the SpotInnerAngle/SpotOuterAngle variables.
This means you set the colour like any other light in ACS. It also means you'll either need to use ZScript+ScriptCall or request a new function to set the angles in ACS.
This means you set the colour like any other light in ACS. It also means you'll either need to use ZScript+ScriptCall or request a new function to set the angles in ACS.
Re: Spot light parameters [color and inner spot]
Ah, ok this works, thanks.phantombeta wrote:...
This means you set the colour like any other light in ACS. ..