How to scale an input number range ?

  • Context: Undergrad 
  • Thread starter Thread starter NikNok
  • Start date Start date
  • Tags Tags
    Input Range Scale
Click For Summary
SUMMARY

The discussion focuses on scaling an input number range for particle attributes in visual effects, specifically transitioning from a range of 0 to 255 to custom minimum and maximum values. The user seeks to maintain proportionality in the scaling process rather than clamping values. The solution involves using the formula NC = C/(M-m)*(NM-Nm)+Nm, where NC represents the new color, C is the input color, M is the maximum, m is the minimum, NM is the new maximum, and Nm is the new minimum. This approach allows for a flexible adjustment of particle attributes based on grayscale values.

PREREQUISITES
  • Understanding of particle systems in visual effects
  • Familiarity with color theory and scaling functions
  • Basic knowledge of mathematical transformations
  • Experience with scripting for particle behavior manipulation
NEXT STEPS
  • Research mathematical scaling functions and their applications in graphics
  • Explore particle system attributes in software like Blender or Unity
  • Learn about color manipulation techniques in visual effects software
  • Investigate scripting languages used for particle behavior, such as Python or JavaScript
USEFUL FOR

This discussion is beneficial for 3D graphic artists, visual effects designers, and developers working with particle systems who need to manipulate attributes based on input ranges effectively.

NikNok
Messages
2
Reaction score
0
Hello all,

I'm a 3D graphist trying to deal with particles motions and attributes for visual FX

I have a surface mapped with a black and white picture. Those different grey values gives me a x value inbetween 0(min) and 255(max). Particles are shot from this plane and from random positions and get this point value x based on where they have spawn on the surface, so based on the value of the gray pixel they spawn onto.

I want to play on the speed, size, and more attributes of those particles based on this grey value x.

I need to define a custom minimum and a custom maximum value. So basically, I need to go from :

0 <= x <= 255

to y(min) <= x <= z(max) which can be else -50 <= x <= 50 or else 33.25 <= x <= 68.1

The thing is I want to keep the proportionality in my values
So it is not a clamping function, like

if x > z then x = z
if x < y then z = y

It would be more of a scaling function. Is it ??
Sounds to me like changing the limits of my range (function ?)

It is actually the level function of photoshop,whitout the gray marker
I can right down a script to apply to my particles behavior.

Am I clear enough ? Can you help me ?
 
Last edited:
Physics news on Phys.org
NikNok said:
Hello all,
I need to define a custom minimum and a custom maximum value. So basically, I need to go from :

0 <= x <= 255

to y(min) <= x <= z(max) which can be else -50 <= x <= 50 or else 33.25 <= x <= 68.1

Not sure if I totally understand the problem. But can you just do an addition and a multiplication on each x value?

If the range of the original x's was:
0 <= x <= 255
And you make x* = (x-128) * 0.5
then
-64 <= x* <= 63.5
 
Figured it out, what I was looking for was actually :

NC = C/(M-m)*(NM-Nm)+Nm


NC = new color
C= color imput
M=maximum
m=minimum
NM=new max
Nm=new min

Thanks for paying attention to this, cheers
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K