Page 1 of 1

Spot light parameters [color and inner spot]

Posted: Sat Apr 04, 2020 4:37 am
by martinezz123
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?

Re: Spot light parameters [color and inner spot]

Posted: Sat Apr 04, 2020 9:15 pm
by Kappes Buur
Experiment a bit with the values of inner angles and outer angles, and see what happens:

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

Re: Spot light parameters [color and inner spot]

Posted: Sun Apr 05, 2020 8:18 am
by martinezz123
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.

Re: Spot light parameters [color and inner spot]

Posted: Wed Jul 29, 2020 6:37 am
by Jaska
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:

Re: Spot light parameters [color and inner spot]

Posted: Wed Jul 29, 2020 10:04 am
by wildweasel
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]

Posted: Wed Jul 29, 2020 1:30 pm
by Jaska
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);
Doesn't work either.

Re: Spot light parameters [color and inner spot]

Posted: Wed Jul 29, 2020 2:07 pm
by Nash
wildweasel: that won't work because that string just gets converted to an index on the script's string table.

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]

Posted: Wed Jul 29, 2020 4:41 pm
by Jaska
Thanks Nash. The light still looks the same. I don't get it.

That color picker is nice to know!

Re: Spot light parameters [color and inner spot]

Posted: Thu Jul 30, 2020 12:45 am
by Nash
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);
 

Re: Spot light parameters [color and inner spot]

Posted: Thu Jul 30, 2020 3:31 am
by Jaska
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]

Posted: Thu Jul 30, 2020 4:14 am
by Jaska
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.

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);

	}
}
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.

Re: Spot light parameters [color and inner spot]

Posted: Thu Jul 30, 2020 3:04 pm
by ZZYZX
Generated bytecode seems alright?.. not sure, I'm not an ACS expert

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: TERMINATE
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

Re: Spot light parameters [color and inner spot]

Posted: Thu Jul 30, 2020 3:31 pm
by phantombeta
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.

Re: Spot light parameters [color and inner spot]

Posted: Fri Jul 31, 2020 6:32 am
by Jaska
phantombeta wrote:...
This means you set the colour like any other light in ACS. ..
Ah, ok this works, thanks.