User Tag List

Results 1 to 4 of 4

Thread: RGB Coefficient- Limiting Range From 0-255 to Prevent Invalid Values

  1. #1
    Clicker Fusion 2.5 (Steam)
    LordRichTea's Avatar
    Join Date
    Apr 2020
    Location
    Norfolk, UK
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    RGB Coefficient- Limiting Range From 0-255 to Prevent Invalid Values

    I am making a pseudo-3D game with a level that involves the character standing on a conveyor belt heading into a darkened tunnel and am having trouble with programming the RGB values of objects emerging from the darkness in the distance.

    RGB Problem2.jpg

    I have programmed a formula to alter the RGB Coefficient value dependant on the Y-value of the desired object so that it becomes less dark as it appears to approach the camera.
    This, in theory works when the calculated value is between 0 and 255.

    HOWEVER, when the value is calculated at LESS than 0, the object is then displayed at what I describe as "255" value.
    The inverse also happens once an object appears close to the maximum Y-value, and if the RGB value is more than 255, the object then goes black, as if at "0" value.

    How can I effectively limit the max/min range of this value so that I can avoid this problem?

    I have tried setting up a range condition in the same event, but it doesn't appear to do the job.

    RGB Problem.jpg

  2. #2
    Clicker Fusion 2.5Fusion 2.5+ DLC
    Sleepy's Avatar
    Join Date
    Dec 2019
    Posts
    13
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Maybe you can do it by using min() and max() function like that :

    min(max(0,(#YOUR CALCUL HERE#)),255)

    If your result is below 0, the max function will return 0, if not it will return your result. Then min will do the same if your result is above 255 it will return 255, if not you'll keep your result

    Here is an exemple of how it should normaly work :

    min(max(0,-5),255) = min(0,255) = 0

    min(max(0,521),255) = min(521,255) = 255

    min(max(0,94),255) = min(94,255)= 94

    Hope it help

  3. #3
    Clicker Fusion 2.5 (Steam)
    LordRichTea's Avatar
    Join Date
    Apr 2020
    Location
    Norfolk, UK
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply.
    But how can I incorporate this in order to program the 3 different values (R--,G--,B--) as opposed to just the one? (which tends to only alter the red?)

  4. #4
    Clicker Fusion 2.5Fusion 2.5+ DLC
    Sleepy's Avatar
    Join Date
    Dec 2019
    Posts
    13
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Since your calcul for R,G and B seem to be the same you can do something like this : 15.PNG
    You store the result of your calcul inside a variable and use this variable in GetRGB() function

    Or you can use do the calcul inside of GetRGB like you did in your exemple : 16.PNG

Similar Threads

  1. Calculating a range of global Values
    By VinnieG in forum Fusion 2.5
    Replies: 4
    Last Post: 26th November 2016, 05:40 PM
  2. Limiting Movement
    By Lukiester in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 26th February 2014, 06:32 AM
  3. limiting events
    By willow in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 27th February 2010, 09:22 AM
  4. testing a range of values
    By Atherton in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 15th December 2009, 10:26 AM
  5. Limiting digits
    By MechatheSlag in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 27th February 2009, 06:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •