Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Disable lighting on certain models

A topic by objFrog created Feb 28, 2022 Views: 226 Replies: 3
Viewing posts 1 to 4

Hiya! Absolutely love Fauxton 3d. It's so much fun to work with. I have a question about how I could disable the lighting on certain models.  I have this row of fences for example which are each individually lit. I've been trying to use `fauxton_model_draw_override(model);` within Draw End to disable it. Whatever I'm doing there must be incorrect though because I'm not seeing a difference. Alternatively, if it's easy to somehow "join" these fence models and share the lighting that would be great. Disabling it would be fine as they're just dark brown, but I'm open to any ideas. Thanks!

Hey thanks! Interesting that it is applying the lighting at all! Overriding shouldn't apply the default shader and thus not apply lighting. What you can do is just call the function:

my_model = __FauxtonWriteSpriteStack(sprite_index, x, y, z, color, alpha, angle);
my_tex = sprite_get_texture(ico_texref, 0);

and then in the draw event call:

matrix_set(matrix_world, matrix_build(x, y, z, xrot, yrot, zrot, xscale, yscale, zscale));
vertex_submit(my_model, pr_trianglelist, my_tex);
matrix_reset();

and that will make it so that you only get the actual vertex buffer of a sprite stack instead of all of the extra stuff that Fauxton comes with. Then you might want to make your own shader if but it shouldn't be necessary. 

as for 'joining' models together, the system isn't built for that currently, but I have made it work with 'nine slices' before using texcubes. You would essentially draw each frame of the fence to surfaces, apply the surfaces to the texcube, and then stretch the texcube / surfaces. This way GM will automatically use its 'nineslice' feature and there you go! You have multiple 'fences' within 1 vertex model (so that lighting will work as a whole instead of in pieces). 

Hope this helps! :)

(+1)

Ah thank you for the quick reply! Because you said it should be working, I decided to investigate some more, and yep, silly mistake on my part... fauxton_model_draw_override does the trick all on its own! I was wondering if some sort of nine-slice functionality would be possible so thank you for your thoughts on that. Setting up a system like that probably won't happen in this project but glad to have a starting point if I decide to try it! The fences are looking great now :D

Wow that looks great! I'm glad you got it all worked out! :P