Forum: Poser - OFFICIAL


Subject: Candle Flame Shader For Firefly... (Use Postwork Answer Is For Cowards!)

3dcheapskate opened this issue on Mar 05, 2020 ยท 100 posts


3dcheapskate posted Mon, 09 May 2022 at 3:03 AM

Removing the spectacles that conceal my super-secret Clark Kent identity, and hoping that nobody spotted that, I'll continue...

Having a quick shufti through the PP2012.mm1.txt that was included in the MatmaticDemos I noticed that IColor seemed to be used in the same sort of way that rgb was. Neither IColor nor rgb appear in the NodeReference.html. But since PP2012.mm1.txt compiled okay I thought it was worth a try.

Success

Here's the amended matmatic script below the line




# bagginsbill's matmatic script for a candle flame

# https://www.renderosity.com/forums/threads/2943991?page_number=2#msg4383217

# The compiler errors on the yellow = rgb line

# changed the 3 rgb references to IColor which is what the PP2012.mm1.txt seems to use, and that complied


AV = Bias(V, .25)


cy = .22


x = EdgeBlend(0, 1, .2) ** 2

y = (AV - cy) * .5

gy = 10

ygrad =  Clamp(1 - Abs(y * gy)) ** 2

blueopacity = Clamp(10 * x * ygrad)


py = Clamp(5 * Abs(AV - .3)) ** 2

px = (1 - EdgeBlend(1, 0, 2)) ** 2

darkpatch = 1 - Clamp((py + px) ** .5)


gy = Clamp((AV - cy) / (1 - cy))

gyp = (4 * gy * (1 - gy))**2

yellowopacity = Clamp(EdgeBlend(1, .3, 3) * Clamp(gyp - darkpatch))


yellow = IColor(255, 255, 200) 

orange = IColor(255, 200, 100) 

yellow = EdgeBlend(yellow, orange, 3)

blue = IColor(30, 30, 255)

yclr = HSV(yellow, 1, 1, yellowopacity)

bclr = HSV(blue, 1, 1, blueopacity)

clr = HSV(bclr + yclr, 1, 1, 5)



s = Surface(0, 0, 0, 0)

s.Alternate_Diffuse = clr

s.Transparency = .8

s.Transparency_Edge = 1

s.Transparency_Falloff = 1




And here's the result of applying it to the flame of the Poser candle that I posted over on the corresponding Hivewire thread. Note that all lights were deleted so illumination is from the flame itself

Superfly:


Firefly:



I'll post the MT5 (or MC6) over on the Hivewire thread as I can't do that here.


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).