Scaling palettes to 240?

Scaling palettes to 240?

I’m curious as to why in Fire2012 there is this comment about palettes :

  // Scale the heat value from 0-255 down to 0-240
  // for best results with color palettes.

Because right now I’m getting this weird behavior where a simple 2-color palette dips back to the starting color when in the 240-255 range.

Sorry no code for now, I will post an isolated example when I get back to my shop.

Try changing the blending from LINEARBLEND to NOBLEND.

The reason to use values 0-240 rather than the usual 0-255 is because the last 15 colors will ‘wrap around’ from the end to the start of the palette. Sometimes this wrapping (circular blending) is useful as it keeps things smooth, other times (in your case here) it’s not what you want.

If you want to still code using a 0-255 range but have the output maximum be 240 you can use the scale8 function:
scale8( i , 240 )

Got it! Problem solved thank you

I dont think i ever paid attention to my Fire2012 sketch running the blue flame. I may actually have the same issue

@marmil You may have to put this up as a FAQ…two of us in the last month.