Spot light parameters [color and inner spot]

Ask about mapping, UDMF, using DoomBuilder/editor of choice, etc, here!

Moderator: GZDoom Developers

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.

Spot light parameters [color and inner spot]

Postby martinezz123 » Sat Apr 04, 2020 4:37 am

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?
You do not have the required permissions to view the files attached to this post.
martinezz123
 
Joined: 22 Jan 2020
Operating System: Windows 10/8.1/8/201x 64-bit

Re: Spot light parameters [color and inner spot]

Postby Kappes Buur » Sat Apr 04, 2020 9:15 pm

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
User avatar
Kappes Buur
 
 
 
Joined: 17 Jul 2003
Location: British Columbia, Canada

Re: Spot light parameters [color and inner spot]

Postby martinezz123 » Sun Apr 05, 2020 8:18 am

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.
martinezz123
 
Joined: 22 Jan 2020
Operating System: Windows 10/8.1/8/201x 64-bit

Re: Spot light parameters [color and inner spot]

Postby Jaska » Wed Jul 29, 2020 6:37 am

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:
Jaska
 
Joined: 17 Dec 2019
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Spot light parameters [color and inner spot]

Postby wildweasel » Wed Jul 29, 2020 10:04 am

Instead of entering in the decimal number (huh??), try entering the hexadecimal in quotes, like so:
Code: Select allExpand view
SetThingSpecial(11,0,"FF FF FF",8,32,192,0);
User avatar
wildweasel
change o' pace.
Moderator Team Lead
 
Joined: 16 Jul 2003

Re: Spot light parameters [color and inner spot]

Postby Jaska » Wed Jul 29, 2020 1:30 pm

wildweasel wrote:Instead of entering in the decimal number (huh??), try entering the hexadecimal in quotes, like so:
Code: Select allExpand view
SetThingSpecial(11,0,"FF FF FF",8,32,192,0);


Doesn't work either.
Jaska
 
Joined: 17 Dec 2019
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Spot light parameters [color and inner spot]

Postby Nash » Wed Jul 29, 2020 2:07 pm

wildweasel: that won't work because that string just gets converted to an index on the script's string table.

Code: Select allExpand view
// put this anywhere outside a script
function int MakeColor(int r, int g, int b)
{
    return (<< 16) | (<< 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.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Spot light parameters [color and inner spot]

Postby Jaska » Wed Jul 29, 2020 4:41 pm

Thanks Nash. The light still looks the same. I don't get it.

That color picker is nice to know!
Jaska
 
Joined: 17 Dec 2019
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Spot light parameters [color and inner spot]

Postby Nash » Thu Jul 30, 2020 12:45 am

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 allExpand view

SetThingSpecial
(110255255255);
 
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Spot light parameters [color and inner spot]

Postby Jaska » Thu Jul 30, 2020 3:31 am

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 allExpand view

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.
Jaska
 
Joined: 17 Dec 2019
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Spot light parameters [color and inner spot]

Postby Jaska » Thu Jul 30, 2020 4:14 am

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 allExpand view
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.
Jaska
 
Joined: 17 Dec 2019
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Spot light parameters [color and inner spot]

Postby ZZYZX » Thu Jul 30, 2020 3:04 pm

Generated bytecode seems alright?.. not sure, I'm not an ACS expert

Code: Select allExpand view
script "Test" OPEN {
   SetThingSpecial(13,0,0xFF00,8,32,64,0);
}
Code: Select allExpand view
         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
User avatar
ZZYZX
le chat du rabbin
 
 
 
Joined: 14 Oct 2012
Location: Ukraine
Discord: ZZYZX#1394
Github ID: jewalky

Re: Spot light parameters [color and inner spot]

Postby phantombeta » Thu Jul 30, 2020 3:31 pm

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.
User avatar
phantombeta
In the meadow of sinful thoughts, every flower's a perfect one
 
Joined: 02 May 2013
Location: Brazil, South America, Earth, Orion-Cygnus Arm, Milky Way
Discord: phantombeta#2461
Twitch ID: phantombeta_
Github ID: Doom2fan
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Spot light parameters [color and inner spot]

Postby Jaska » Fri Jul 31, 2020 6:32 am

phantombeta wrote:...
This means you set the colour like any other light in ACS. ..


Ah, ok this works, thanks.
Jaska
 
Joined: 17 Dec 2019
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support


Return to Mapping

Who is online

Users browsing this forum: No registered users and 1 guest