• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Discussion GMS2 Vertex Texture Fetch

jva

Member
Hello everyone,
Been using GMS for a long time and was excited when I read GMS2 was supporting DX11 (Vertex texture fetches!).

So I made a quick test for reading height data from a heightmap for a terrain.
On GMS 1.4 GLSL ES VTF works on android. On GMS2 it doesn't seem to work, at least on android or windows targets.

Has anyone gotten VTF to work on GMS2?
If it has not yet been implemented I hope yoyo will add it soon and for most targets, very happy if they do!
Absolutely need this feature!

vtfandroid.jpg heightmap.png

Vertex Shader:
attribute vec3 in_Position;
uniform sampler2D sampler;
varying vec3 v_vColour;
void main()
{
lowp float zh = texture2D(sampler,vec2(in_Position.xy/128.0)).r;
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z+(zh*30.0), 1.0);
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;

v_vColour = vec3(0.25+(zh*0.75));
}

Fragment Shader:
varying vec3 v_vColour;
void main()
{
gl_FragColor = vec4(v_vColour,1.0);
}
 

Juju

Member
Huh. I tried this a while back using GMS1 + OpenGLSL ES on Windows and it didn't work. I'll have to look into this again as this would open up a number of exciting techniques.
 

jva

Member
Hmm works on GMS2 using the HTML5 target.
Gonna test more which targets work and file this as a bug for windows, android and other targets that do not work.

EDIT: Works on iOS too.
On UWP the shader draws a corrupted screen.
Submitted as a bug, hopefully fixed soon for all platforms.
 
Last edited:
M

Multimagyar

Guest
As far as I recall I was experimenting with this iiiin 2015 then I made a tweet about it. I think Mike answered to it as "it's on they wishlist" which means it happens if and when they have time but in no-way a priority. But does not really explain why it works on one or another platform in an inconsistent way (even back then. it worked on android). certainly would be a great feature if it would work in a consistent way. I have not tried to do an HLSL11 shader yet to test it if it works on windows with different shader script, but I assume it does not.
 
Top