Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(+1)

Sorry for reopening but even after this explanaition I still have a prolbem with this.
I set 

fauxton_model_draw_enable(model, false)

in create event

and in draw event Im trying to draw a circle with shader

shader_set(shd_bloom);

draw_circle(x, y, 20, false);

shader_reset();

shader_set(shd_default);

fauxton_model_draw_override(model);

shader_reset();

Model is drawn correctly but circle is nowher to be found. No matter what shader I put shd_default, shd_gmdefault, my shaders, circle just disappear. If there is no shader set the circle is drawn in correct position and angle.

Is there something wrong with how i set up this thing?

(1 edit)

This is due to the fact that things draw differently in 3D than traditional 2D. There could be a number of reasons the shader isn't appearing. Gamemaker doesn't supply a Z value by default to primitives (only vec2 in_Position). A couple of things you can try:

  • Use matrix_set(matrix_world, matrix_build(...)) and set the circle x/y to 0, 0 and only use the matrix to set the x, y and z values
  • Make sure the circle is rotated accordingly (using the matrix build functionality)
  • If you want the circle to just draw and not account for z values you can turn ztest/zwriteenable off
  • Draw the circle to a surface and apply the shader there. The bloom will only work on the bounds of the vertex triangles for the circle, and thus not produce the effect you want (you can see this if you also apply your bloom shader to a circle in 2D instead of to an entire surface)

If the last point is the issue, one thing to remember is that shaders only effect the graphical rendering within the vertices of a quad, so the shader can only grab pixels / extend pixels within those bounds. 

These are just a few examples of things you can test. Fauxton uses more traditional 3D techniques, and as such, requires you to draw things differently than you would in standard gamemaker. 

I highly recommend giving DragoniteSpams Gamemaker 3D tutorials a good watch through to understand some of the concepts used in fauxton at a much deeper level. :)

(+1)

the problem was not that the shader does not give its effect, but that setting the shader makes the correctly drawn circle disappear. The suggestions with matrixes did not work, but that is because the circle, as I wrote, is drawn in the right position with the right rotation already. The solution with the surface worked, but out of curiosity I checked other shapes and I am wondering about things you can see in attached screenshots. Why does only the circle behave like this under the influence of any shader?

In any case, thanks a lot.

(1 edit)

Interesting that it is only circles. It could just be the order GM renders the vertices. You can try turning off culling to see if that fixes it? Or rotate the circle around. If GM creates circles (for whatever reason) clockwise, then its probably trying to show you the 'back' of the circle instead. 

gpu_set_cullmode(cull_noculling)

Other than that though, Maybe the shader format is wrong? Idk that is really strange. haha.