• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Getting texture data in vertex shader?

J

Jorppa

Guest
I recently purchased GM:S 2 with plans to make a 2d-3d hybrid game for Windows. For the 3d portion I would need high-performance 3D dynamic height maps as I'd like to maximize rendering speed.
Rendering a static heightmap is no issue for me, but I want it dynamic.

I experimented with shaders and they seemed very promising for the job. I managed to alter vertices' z-values with random values and have virtually no FPS hit.
The issue is that I can't figure out how to pass the actual heightmap values into the Vertex Shader.
One solution would have been to pass the heightmap texture or 2d array into the Vertex Shader. It seemed this is not possible in GM:S 2?

I found no working examples online. I noticed some old threads that mentioned that a .dll is needed to get texture data in the vertex shader. For example here is a Similar issue
Note that I am new to shaders. Did I just miss something, or is there a .dll or some extension I can use? Anyone have experience in this?

Thanks!
 

Joe Ellis

Member
It's called vertex texture fetching, I have a dll that can do this, it basically loads the texture from a png in a different format to how it usually does and then uses another "set" function to pass it to the vertex shader.
This might seem like the perfect solution, but you can't edit the texture dynamically, you can only offset the uvs or do something with uniforms to make it read the texture differently, but the pixels on the texture can't be changed. So that ruins the whole thing you want to do.
Are you trying to do a similar thing to Populous 3? Cus that is definitely possible by splitting the terrain into smaller pieces, then you can rebuild small vertex buffers with only 12 quads or so without any lag
 

Joe Ellis

Member
Yeah I'll send it you if you want. It is good for what it does.. You'll have to wait a day or two, it's buried somewhere
 
Top