Godot Version
4.3
Question
I have a 3D scene where my character moves around on a plane. I want to use GPUParticles2D with a subviewport, and then render or project the particles onto the plane, or in the planes shader. The goal is to create a trail using particles, but have it render on the plane as a texture (or project, decal, any other solution). Is this possible?
Is there a reason you want to use a subviewport? It might help to know what you want the player to see. The player moving through water? Through grass? Those would both be 3D shaders applied to the plane. Dust trails? That would probably be a particle system applied to the player’s location.
It seems like you’ve gone about three steps down the road of a solution, but you may be making this way more complex than you need to. What are you trying to accomplish?
1 Like
Yea, basically I have a player ship that moves in 3d(but just X and Z, with Y bobbing), on an ocean plane. The ocean plane has vertex displacement and normals to form waves. I want to use a particle system for the foam/wake from the ship, because it’s easier to make this with particles than shader, and then project that onto the waters surface so it “sticks” to the waves.
I have also tried doing it all in the ocean plane’s shader, but I ran into a problem where I could not store foam positions in the shader. My set up here was to pass the ships position as a global shader variable, and then make sort of a V shape foam/wake behind the ship(using other vars like ship speed and forward vector to manipulate it. However, I was not able to make the wake persist when the ship moves, thus leaving a trail. If I could get this to work, it would also achieve the effect I want, where the ship creates foam in the shader that fades over time (leaving a trail). The biggest problem here is that my ocean plane is basically a central chunk, with lower LOD chunks far away, and the ocean plane moves with the players position to create an infinite ocean effect. This seems to make storing positions on it in the shader impossible.
So, the 2 options I could not figure out:
-
particle system for foam, projected onto the ocean plane(using subviewport or decal?)
-
ocean shader foam created at ship positions, fading out over time. So, the shader must be able to store positions.
OMG! That looks gorgeous! Ok, I have an idea. There are a number of grass shaders that makes changes based on the player’s collision. Here’s a Scripted Version. Here’s a quick 5 minute video tutorial and a longer 40 minute tutorial. Obviously you’re going to have to change your shader to foam instead of move because of the grass, but it might give you some ideas.
1 Like
Thanks! I’m checking them out now.
After thinking about it, what I’m trying to do with the foam is similar to leaving footprints in snow, but they fade out based on time, not distance to player.
1 Like