[UPDATE] LIGHTING IS HERE!


v 2.2.0

Nodes

  • [ADDED] World Environment Node
  • [ADDED] Point light node
  • [ADDED] Spot light node

Functions

  • [ADDED] fauxton_buffer_set_uniform_script(buffer_name_or_id, uniform_control_script)
  • [MODIFIED] draw_sprite_3d OPTIONAL parameter 'enable_lighting'
  • [MODIFIED] draw_sprite_3d_ext OPTIONAL parameter 'enable_lighting'

Fixed

  • [FIXED] fauxton_buffer_set (Would return an error)

Lighting is here!! With Fauxton 3D you can easily add lighting to a scene by just adding an instance of WorldEnvironment and either point lights or spotlights! Fauxton supports up to 64 different spot/point lights. This can be changed, however, by going into shd_default and change all numbers in the fragment shader that are 64. Let's look at what each of these nodes contains! 

** NOTE **

If you override buffer shaders with your own you will have to calculate lighting in your new shader! It is suggested that you should duplicate the shd_default shader and its uniform script found in:

RenderPipeline 

    > pipeline_initiate() 

        > default_world_shader_set()

And then proceed to make your changes.

Fig 14

World Environment

First, we have the WorldEnvironment node. This node MUST be added to a room in order to enable lighting. There are a few options in this node under the Variable Definitions button.

Fig 15

AmbientColor

The ambient color of our scene. The ‘Shadow’ color in a sense.

SunColor

The Color of our directional light 

SunIntensity

The intensity of our directional light

SunPosition

The position of our directional light

The AmbientColor will be the color of the ‘shadows’ or rather the color of the scene facing away from the sun. Setting this to white ( $ffffff / c_white ) will make it so that the shadows are completely illuminated. 

The SunColor is the color of our scene lit from the SunPosition. The sun position is an array that contains an X, Y, and Z. These values should be between a value of -1 and 1. So for example:

[ -1, -1, 0 ]

The sun is at the TOP-LEFT corner of the room at a z of 0 (straight on)

[ 1, 1, 1 ]

The sun is at the BOTTOM-RIGHT corner of the point DOWN in z-space

Due to the fact that sprite-stacks are just a series of stacked planes on top of one another it should generally be avoided setting the sun's z-position to -1 (as you will not easily be able to see them illuminated from the bottom).

Point Lights

Point lights are SUPER easy to add-in. Once you have an instance of WorldEnvironment added to your room you can add up to 64 point or spot lights! You can find the attributes for point lights in the Variable Definitions:

z

The z position of the light

color

The Color of the light

range

The radius or ‘range’ of the light

Spot Lights

Spotlights are SUPER easy to add-in. Once you have an instance of WorldEnvironment added to your room you can add up to 64 point or spot lights! You can find the attributes for spotlights in the Variable Definitions:

z

The z position of the light

color

The Color of the light

range

The radius or ‘range’ of the light

cutoff_angle

How many degrees to cut light to (smaller = spike, larger = bowl)

angle

The x/y angle of the light (imagine this like image_angle)

z_angle

The z angle of the light (how much the light points up or down)

NEW FUNCTIONS: fauxton_buffer_set_uniform_script

This function allows you to set a custom shader uniform control script for a buffer created using fauxton_buffer_create.

Syntax:

fauxton_buffer_set_uniform_script( buffer_id_or_name, uniform_control_script);

Argument

Description

buffer_name

The name (string) or ID (index) of the buffer to set

uniform_control_script

The shader uniform control script for the buffer

Returns:

N/A

Example:

var uniform_script = function(){

    var uni = shader_get_uniform(shd_grass_sway, "time");

    shader_set_uniform_f(uni, current_time/250);

}

fauxton_buffer_create("GrassBuffer", shd_grass_sway);

fauxton_buffer_set_uniform_script(“GrassBuffer, uniform_script);

First we create a script to control our grass shader called uniform_script. We then create a buffer, set the shader to shd_grass_sway and set the uniform control script to our uniform_script.

Files

Fauxton 3D ( v_2.2.0).zip 9.2 MB
Jun 04, 2021

Get Fauxton 3D

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.