#How to store vertex datas changed with a shader?

1 messages · Page 1 of 1 (latest)

quiet temple
#

Hi, i am learning shaders. I wrote a vertex fragment shader to change an object's texture based on distance with another object. But i don't know how to store changed datas. How can I store which vertex's texture has changed? Should I store them in another texture and if so, how can I do that?

orchid fulcrum
quiet temple
#

My shader has two properties; position, texture1, texture2. I change position in runtime and it calculates the position between vertex and the position property.

#

And it changes vertex's texture if it is away

#

Example: Distance is 4.5f and my max distance is 4f so the textures changes to texture2 from texture1 for that vertex. But after that, i want to store the data and prevent that vertex to get texture1 data again.

#

@orchid fulcrum

orchid fulcrum
#

But why? What effect are you trying to achieve

quiet temple
#

I am trying to make a fruit peeling effect.

#

It can be done without shader but it is too heavy for the cpu.

#

So I should make the mesh deformation and other texture effects within a shader.

orchid fulcrum
#

And you use compute shader for that right?

quiet temple
#

Yeah

#

Well at least I am trying to 😄

orchid fulcrum
#

Why you then talked about vertex shader earlier?

quiet temple
#

Well I don't know the "compute shader" term I thought they are the same thing

orchid fulcrum
#

Nope

quiet temple
#

I worked with surface and vertex fragment shaders

orchid fulcrum
#

Nope, not the same

#

Vertex/fragment shaders are not supposed to save anything. Compute shaders can read and write to render textures and buffers

quiet temple
#

So I should work on compute shaders

orchid fulcrum
#

Yes