Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    renderEffect() parameters

    Help
    4
    12
    439
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Zero Division
      Zero Division last edited by Zero Division

      Update: edited title to reflect increased generality of topic.

      Thanks to an example I saw by @Dave I have fx_crt working on my current favorite hang out in FUZE:

      "Selavi Games/cafe"
      

      I'm aiming to set it up to look like an NTSC display of the Super Famicom era. The scanlines look pretty good where I've set them, but there are still too many colors. I was thinking I would posterize it and hopefully get a dithered 90's look out of it, and also clamp it to the SNES color palette in the same go.

      Does anyone know what the parameters are for (what I assume is called) fx_posterize?

      1 Reply Last reply Reply Quote 0
      • Dave
        Dave Fuze Team last edited by

        You're right it is indeed called fx_posterize. The command will look like this:

        renderEffect( image, frameBuffer, fx_posterize, [ levels ] )
        

        Where levels is the number of intensity levels per colour channel. I found a really SNES looking palette at about 8, but I was using pixel art with this effect so there's already a limited palette going on there.

        Experiment! You can make things look deliciously NES-like with it :)

        1 Reply Last reply Reply Quote 1
        • Zero Division
          Zero Division last edited by

          So It's just one number for levels, rather than a vector or something?

          Now let's do fx_outline! (This is fun,) Trying multiple params didn't seem to help. Does it only do red? Or am I doing it wrong?

          1 Reply Last reply Reply Quote 0
          • Dave
            Dave Fuze Team last edited by

            Yeah it is just the one number.

            Haha, alright! Outline would be the following:

            renderEffect( image, frameBuffer, fx_outline, [ threshold, 0, 0, 0, r, g, b ] )
            

            Currently you must put 0's in those slots. They are unused parameters but must be filled - this will change in future.

            RGB are 0-1 range. 0.1 gives very interesting results!

            Zero Division 1 Reply Last reply Reply Quote 2
            • Zero Division
              Zero Division @Dave last edited by

              @Dave Trying to figure out how to make a color image look monochrome. I thought maybe fx_colourAdjust. Either that or maybe fx_toneMap.

              Any help with parameters would be much appreciated.

              pianofire 1 Reply Last reply Reply Quote 0
              • pianofire
                pianofire Fuze Team @Zero Division last edited by pianofire

                @Zero-Division We could do with having these fully documented

                I have had a play with fx_colourAdjust and have managed to display a colour image in black and white

                The arguments are fx_colourAdjust [ biasR, biasG, biasB, unused, gainR, gainG, gainB, unused, curveR, curveG, curveB, saturation ]

                image = loadImage("FUZE/Trains")
                renderEffect(image, framebuffer, fx_colouradjust, [ 0.5, 0.5, 0.5, 0, 0.5, 0.5, 0.5, 0, 5, 5, 5, 0 ])
                update()
                sleep(3)
                

                0.5 seems to be the value for unchanged on most of the parameters
                a saturation of 0 is black and white
                I am not really clear how the curve values work

                1 Reply Last reply Reply Quote 2
                • Zero Division
                  Zero Division last edited by

                  For anyone reading this thread, the parameters for the various effects are now documented under Help->Commands->renderEffect

                  1 Reply Last reply Reply Quote 1
                  • pianofire
                    pianofire Fuze Team last edited by

                    Yes it tells you what the parameters are here: https://fuzearena.com/help/view/renderEffect

                    1 Reply Last reply Reply Quote 1
                    • Tratax
                      Tratax F last edited by

                      @Dave - Question, can we apply multiple render effects and layer them ?

                      Gonna have a play around tonight and was thinking how the scanlines and other effects may work together :)

                      1 Reply Last reply Reply Quote 0
                      • Dave
                        Dave Fuze Team last edited by Dave

                        Absolutely you can, there are a few ways to do it, and it depends on what you're going for. The basic form of daisy-chaining them is as follows:

                        gw = gwidth()
                        gh = gheight()
                        
                        // first, you'll need separate draw target images for each effect
                        img = createImage( gw, gh, false, image_rgba )
                        img_2 = createImage( gw, gh, false, image_rgba )
                        img_3 = createImage( gw, gh, false, image_rgba )
                        
                        loop
                            setDrawTarget( img )
                            clear()
                            // all the things you want to draw
                        
                            setDrawTarget( frameBuffer)
                            clear()
                            
                            // render the first image to the second with an effect:
                            renderEffect( img, img_2, fx_crt, [ 180, 2, 0.01 ] ) // for example
                            // now render the second image to the third with another effect
                            renderEffect( img_2, img_3, fx_outline, [ 0.1, 0, 0, 0, 1, 1, 1 ] )
                            // finally, render the third image to the frame buffer, with another effect if you want!
                            renderEffect( img_3, frameBuffer, fx_posterize, [ 1 ] )
                            update()
                        repeat
                        

                        So that's the daisy-chaining. You can do this with as many or as few effects as desired.

                        The second way to go about it is to render each effect separately, to different draw targets, then draw them all at once to the frame buffer, effectively "overlaying" the images. This would allow you to have a blur effect for example only applied to a portion of an image, with a crt filter applied to the rest.

                        img = createImage( gw, gh, false, image_rgba ) // The rgba part is especially important here as the transparency is necessary to overlay the images.
                        img_2 =  createImage( gw, gh, false, image_rgba )
                        img_3 =  createImage( gw, gh, false, image_rgba )
                        
                        loop
                            setDrawTarget( img )
                            clear()
                            // all the stuff for this image
                        
                           setDrawTarget( img_2 )
                           clear()
                           // all the stuff for this image
                            
                           setDrawTarget( frameBuffer )
                           renderEffect( img,     frameBuffer, fx_crt, [ 8, 3, 0.001 ] ) // render first image to frameBuffer with a crt shader
                           renderEffect( img_2,   frameBuffer, fx_blur, [ 1/50, 1/50, 1, 1 ] ) // render second image to frameBuffer with a blur effect
                        
                            update()
                        repeat
                        

                        Of course, all the examples there just use arbitrary values for the purposes of providing a working example - let me know how you get on!

                        Tratax 1 Reply Last reply Reply Quote 2
                        • Tratax
                          Tratax F @Dave last edited by

                          @Dave Thanks mate, appreciate the detailed answer! I'll have a play and share some results :)

                          1 Reply Last reply Reply Quote 1
                          • Dave
                            Dave Fuze Team last edited by

                            No worries at all mate, enjoy! I think I will copy and paste that info into hints and tips

                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post