Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
141 stars 2 forks source link

Give FootstepSoundSplatmapSplitter a option to use highest channel value for a splatmap #2942

Closed ohzee00 closed 2 months ago

ohzee00 commented 2 months ago

Is your feature request related to a problem? Please describe.

Currently, if I'm not misunderstanding the feature, FootstepSoundSplatmapSplitter splits up sounds based on what color channel is being walked on. However, some splatmaps use mixing to make more varied terrain, ex: red channel for grass being mixed into rocks(blue) for cliffs. In this situation that would mean a grass sound will play when visually you expect a rock sound effect to play.

Describe the solution you'd like

A ability for the component to use the highest channel value, or even a threshold to determine which sound definition to play.

Describe alternatives you've considered

I could instead author the already done splatmaps to be more binary in their sections, however this limits how I would want a terrain to look.

Additional Context

For context, this is the terrain and splatmap I'm working with: image

For each channel I put the emissive to 1 in their respective colors, you can see that Red makes up a majority and it being mixed into the other channels.

In the test world that was used to test this feature, the splatmap is very binary in its sections: image

Requesters

Ohzee

Frooxius commented 2 months ago

The system should already be doing this - it checks which of the channels has brightest value and plays that sound effect.

What kind of behavior are you seeing exactly with this? Are you able to provide the splatmap?

ohzee00 commented 2 months ago

Here is the splat map (it's bigger than 10mb so I'm using a friend's CDN) https://cdn.protogen.zip/api/shares/g5OTY0N/files/52687060-ed65-46c8-bf56-33d2130a94df

And this is the behavior I'm seeing- or well, hearing in this case, totally didn't steal your idea for saying the name of the material to debug things:

https://github.com/user-attachments/assets/d7753655-6d65-48a5-ae39-97c923105653

And here is the overall setup: Resonite_2024-09-12_20-03-38

Frooxius commented 2 months ago

Hmm... there's a few things here:

1) Technically this is using the splatmap wrong(ish). All the channels should add up to 1.0 - if they don't, they'll be normalized as if they did, so it works, but having red be 1.0 everywhere doesn't make too much sense - proportionally the effective value will be lower - but the values will still be same ratios relative to each other - so even pre-normalizing them wouldn't help here 2) In a lot of the areas, the red color is the most intense - so it triggering grass is technically correct and doing what you're asking for in this issue - it picks the one that's strongest value of them all

There's a few things we could do here: 1) One more I considered adding is where it plays multiple effects, mixed proportionally based on the splatmap (above certain threshold). That way you can get a combination of "grass + gravel" for example 2) Add a multiplier/weight for each channel - this would let you lower the influence of the red relative to others, so even if red is technically the most dominant, the other colors will easily override it

ohzee00 commented 2 months ago

I see, I'm not too surprised to learn that we did the splatmap wrong even if it visually looks alright. Thank you for letting me know that, splatmaps can be a bit confusing especially trying to visualize it properly.

Both of those suggestions sound fairly nice for modifying this behavior, the second one especially given it can help offset issues in user content.

Frooxius commented 2 months ago

I made the changes in 2024.9.13.672! Closing this now! Thanks!