Added Fade In / Out And New Particle System


First, I'd recommend that you read yesterday's post to understand where the fade in / out effect is being applied: https://andrewnreinke.itch.io/funmi/devlog/313954/circular-texture

Tagging this as a tech post as I think ya'll might get a cool new idea for how to write some shader pipe code or something to do the fade in / out effect in your own game or even how to think differently about particles in terms of the perf of them or just maybe a thought to change things out for design like purposes.

To do the fade in / out effect, it was really quite simple. You just get the distance away from the wall and use that as a percentage that multiplies the final output texel color before finishing the pixel shader / fragment shader / texel fill routine.

To get the distance, in my case, it was really simple. All I had to do was subtract the player's current position from the wall it's facing's x or z depending on what wall you're talking about (z if top or bottom, x if left or right). I just passed that value to the DX12 part of my code as a new variable in the CBV and it worked out fine.

As I write this, I might actually re-upload the game as I realized I did a full rgba mul by this percent and not just the alpha which gives a different gfx but I need to decide which of the two I like before doing this so yea.

The other thing that I changed today was the particle system code. Before, I actually would generate cubes that would then be pushed to render. To actually draw these cubes, you'd have to draw 12 triangles (6 faces, 2 triangles per face on a cube) which takes more time than just drawing 1 triangle per particle. I didn't measure any of the perf gain or loss from this as I actually originally wanted to just try different shapes for the particle and am quite happy with simple 2d triangles that rotate around which ends up looking like some sort of leaf and gives a "serene" kind of feeling.

Please let me know your thoughts on my game! Thank you for reading and have an awesome day :]

Files

Funmi_Zip.7z 4 MB
Nov 13, 2021

Get Funmi

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.