<p>Imagine I have an x value that ranges from 1-100. The light source is pointed at x=50.</p>

<p>From points 35 to 65 I want intensity to be 1</p>

<p>At the ends (ie 1 and 100), intensity should be 0</p>

<p>What formula should be used to model the in between values ?</p>

<p>Cosine ? Inverse square law ? ratio ?</p>

CC BY-SA 4.0
2019-05-12T12:52:31.717Z
What formula "should" be used depends on what you're trying to achieve. What's the situation you want the light to model?
Dan Hulme
CC BY-SA 4.0
2019-06-14T14:18:09.737Z
smoothstep(0,35,x) and ( 1.0 - smoothstep(65,100,x) )
game development germ
<lighting>
gradual transition of light intensity formula
MD Luffy
# gradual transition of light intensity formula

(Asked by: username_0 on 2019-05-12)

Imagine I have an x value that ranges from 1-100. The light source is pointed at x=50.

From points 35 to 65 I want intensity to be 1

At the ends (ie 1 and 100), intensity should be 0

What formula should be used to model the in between values ?

Cosine ? Inverse square law ? ratio ?

**Tags:** lighting

> **Comments:**
> **username_1**: What formula "should" be used depends on what you're trying to achieve. What's the situation you want the light to model?  
> **username_2**: smoothstep(0,35,x) and ( 1.0 - smoothstep(65,100,x) )  

---

## 0 answers

