Jump to content

Fire Procedural Texture


OXY11
 Share

Recommended Posts

Hi, 

some doubts about the Fire Procedural Texture parameters  "var fireTexture = new BABYLON.FireProceduralTexture("fire", 512, scene);"

this seems not to work:
fireTexture.autoGenerateTime = false;
fireTexture.time = 0;

 

and the array of 6 colors in which parts of the fire/flames refer exactly?

fireTexture.fireColors = [
                    new BABYLON.Color3(0.1, 0.0, 0.5),
                    new BABYLON.Color3(0.0, 0.0, 0.5),
                    new BABYLON.Color3(0.1, 0.0, 0.2),
                    new BABYLON.Color3(0.0, 0.0, 1.0),
                    new BABYLON.Color3(0.1, 0.2, 0.3),
                    new BABYLON.Color3(0.0, 0.2, 0.9)
                ];

 

 

 

Link to comment
Share on other sites

Hello :)

What do you mean by "seems not to work" ? It works on my machine

These 6 colors are used to be mixed together following some weights (the weights which are used to interpolate the two given color values):

mix(color1, color2, weight1) + mix(color3, color4, weight2) - mix(color5, color6, weight3)

It looks like the color5 and color6 are related to the Y coordinates of the texture. color3 and color4 related to the X coordinates of the texture. color1 and color2 mostly used to be ambient colors of the flames. Following this shader's code: https://github.com/BabylonJS/Babylon.js/blob/master/proceduralTexturesLibrary/proceduralTextures/fire/fireProceduralTexture.fragment.fx#L40

Link to comment
Share on other sites

Time is the parameter used to "move" the fire.

A specific fire state is related to a specific "time" value.

By default this is set by the render method of the FireProceduralTexture : https://github.com/BabylonJS/Babylon.js/blob/master/proceduralTexturesLibrary/proceduralTextures/fire/babylon.fireProceduralTexture.ts#L29

You can set that yourself setting _autoGenerateTime to false and change its value in your rendering loop. In most cases setting the speed is enough :)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...