Cool VL Viewer forum

View unanswered posts | View active topics It is currently 2024-03-19 02:28:39



Reply to topic  [ 8 posts ] 
LSL PRIM_POINT_LIGHT values don't match color picker 
Author Message

Joined: 2016-06-19 21:33:37
Posts: 337
Location: Columbus area, OH, USA
Reply with quote
I'm not sure if this might be A) intentional, B) a viewer quirk or C) a Linden issue.

While trying to do something simple like:
Code:
default
{
    state_entry()
    {
        llSetPrimitiveParams([ PRIM_POINT_LIGHT , TRUE, <1.0, 0.5, 1.0>, 0.4, 1.0, 0.5 ]);
        list params = llGetPrimitiveParams([PRIM_POINT_LIGHT]);
        llOwnerSay("Color: " + llList2String(params, 1));
    }
}
The object seems to retain those values, as shown by the output. Editing the object and inspecting the Feature tab and Light Color shows R: 255, G: 188 B: 255. Given how the face color works, it seems like the values should be R:255, G:127 and B:255.

Any values used for the vector, in the script, result in a slightly 'off' value in the picker, greater than the script input value 'converted' to 255 'scale'. Given the subtle nature of light and face colors, I can't actually tell if the rendered value in world is incorrect. Might this variance be intentional because it is emitted light vs a reflective face?

*Edit for version info:
Code:
Cool VL Viewer v1.28.2.60, 64 bits, Feb 26 2022 09:42:41
Release notes

You are at 277777.0, 255909.0, 22.0  in Muddy Run located at
simhost-0420e3e1223b7d7cd.agni.secondlife.io (34.219.204.193:13027)
Alias: ec2-34-219-204-193.us-west-2.compute.amazonaws.com
Second Life Server 2022-02-10.568388
Release notes

CPU: AMD Ryzen 7 3700X 8-Core Processor (4257.02 MHz)
Memory: 64283MB
OS version: Linux-x86_64 v5.16.12-200.fc35.x86_64 #1 SMP PREEMPT Wed Mar 2 19:06:17 UTC 2022
Memory manager: jemalloc v5.2.1-20220224
Graphics card vendor: NVIDIA Corporation
Graphics card: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2
OpenGL version: 4.6.0 NVIDIA 510.54
Detected VRAM: 11264MB
J2C decoder: OpenJPEG: 1.4.0.635f
Audio driver: OpenAL v1.1 ALSOFT 1.19.1 (OpenAL Soft: OpenAL Soft)
Networking backend: libcurl 7.47.0/OpenSSL 1.0.2u/zlib 1.2.11.zlib-ng
Embedded browser: Dullahan 1.12.4/CEF 98.2.0/Chromium 98.0.4758.102
Packets lost: 0/2043 (0.0%)

Built with: GCC v5.5.0
Compiler-generated maths: SSE2.

Compile flags used for this build:
-O3 -fno-delete-null-pointer-checks -fno-ipa-cp-clone -fno-align-labels -fno-align-loops -fsched-pressure -frename-registers -fweb -fira-hoist-pressure -DNDEBUG -std=c++14 -fno-stack-protector -U_FORTIFY_SOURCE -fno-threadsafe-statics -fPIC -pipe -g -gdwarf -gstrict-dwarf -fno-var-tracking-assignments -fexceptions -fno-strict-aliasing -fvisibility=hidden -fsigned-char -m64 -mfpmath=sse -fno-math-errno -fno-trapping-math -pthread -Wall -Wno-reorder -Werror -DLL_LINUX=1 -DLL_JEMALLOC=1 -DLL_PHMAP=1 -DLL_IOURING=1 -DLL_SDL2=1 -DLL_FMOD=1 -DLL_OPENAL=1 -DXML_STATIC


2022-03-10 18:09:57
Profile

Joined: 2009-03-17 18:42:51
Posts: 5523
Reply with quote
Did you try with LL's official, viewer ?... I get the same results with it here.

The light colour is a linear colour, while the file picker uses a sRGB colour. This is why 0.5/1.0 (linear) = 188/255 (sRGB) for any colour component. Whether this is a LSL bug or bad documentation of the PRIM_POINT_LIGHT primitive parameter, I cannot tell. Please, ask LL, via their JIRA...


2022-03-10 18:43:35
Profile WWW

Joined: 2016-06-19 21:33:37
Posts: 337
Location: Columbus area, OH, USA
Reply with quote
Thanks Henri. I somewhat suspected it might be 'Linden'-side. I'll see about testing with an official viewer, if I can get one set up on the machines I have.


2022-03-10 19:12:32
Profile

Joined: 2009-03-17 18:42:51
Posts: 5523
Reply with quote
ZaneZimer wrote:
I'll see about testing with an official viewer, if I can get one set up on the machines I have.
You can run LL's Windows viewer via Wine under Linux... This is what I do to avoid having to reboot on a Windoze partition when just needing to do a quick test.


2022-03-10 19:27:20
Profile WWW

Joined: 2016-06-19 21:33:37
Posts: 337
Location: Columbus area, OH, USA
Reply with quote
I do have Wine installed since I occasionally use voice so I may give that a try. I just avoid Windows like a plague. :-) I was searching in JIRA and this may have already been reported: EEP - Point and projector light colors are not being submitted in the correct color space which point to this: Projected light color does not match colors set by script.


2022-03-10 19:32:19
Profile

Joined: 2016-06-19 21:33:37
Posts: 337
Location: Columbus area, OH, USA
Reply with quote
I thought I would add this LSL conversion hack here, so that others may use until/if the JIRA, mentioned above, is addressed. This is derived from the explanation to convert sRGB to linear, here: A close look at the sRGB formula. I have done some very brief testing and am using this method now but YMMV.
Code:
// Convert component s to linear float
float StoLinear(float s) {
    if(s <= 0.04045)
        return s / 12.92;
    else
        return llPow(((s + 0.055) / 1.055), 2.4);
}

// Convert sRGB 0-255 vector to linear color vector (useful for prim light)
vector RGBtoLinearColor(vector rgb) {
    vector color = rgb / 255.0; // scale to sRGB 0-1.0 vector
    return <StoLinear(color.x), StoLinear(color.y), StoLinear(color.z)>; // transform each vector component
}


2022-03-10 23:57:40
Profile

Joined: 2009-03-17 18:42:51
Posts: 5523
Reply with quote
Yes, this is the equivalent of what is used in the viewer: see the sRGBtoLinear() function, and its opposite linearToSRGB() one in linden/indra/llmath/llmath.h.


2022-03-11 00:32:55
Profile WWW

Joined: 2016-06-19 21:33:37
Posts: 337
Location: Columbus area, OH, USA
Reply with quote
Henri Beauchamp wrote:
Yes, this is the equivalent of what is used in the viewer: see the sRGBtoLinear() function, and its opposite linearToSRGB() one in linden/indra/llmath/llmath.h.
I didn't even think to look in the viewer code for an example. :? Doh!


2022-03-11 01:20:00
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.