I also noticed that I get this error repeating over and over:
Draw failed due to invalid input layout
I realise that this is due to the use of in_Normal in the fragment shader, but have I missed a step somewhere that prevents this error from happening? Unsure if it's related to the other issues I had.
Someone else ran into the lighting problem a few days ago, there seems to be something wrong with the specular reflection code that’s making the highlights appear in the wrong direction. For now if you disable that with cluck_set_spec_strength(0) it should work, I’m going to try to find out why it’s doing that.
For the fog, I’ve never seen that before. Can you send me a copy of the project?
If you have a github repository you can send me the link or that, otherwise you can throw it on a google drive and send it to me here, or on bluesky or something if you don’t want the link open to the public
Sorry for the delay, just got back from being away for a few days - there’s supposed to be, I might have to update the documentation and a few things like that, I’ll get back to you on that… hopefully soon
Okay, sorry for the delay, I probably should have dealt with this way sooner - the function cluck_set_normal_texture should take care of that, call it before you submit a vertex buffer (make sure to give it a texture ID and not a sprite)
Oh I see where I missed it. I was working off the code in the file Sample Project - Chickens.yyz and the script was not included in there. Thanks a lot,
i’ve never ran it on Android, but in general you probably want to limit the number of lights on mobile hardware much more aggressively than you do on everything else
In principle it should, I’ve never tried it though - that might be a fun experiment. If you’re using point or cone lights you’d have to be mindful of the exact depths that your sprites are drawing at.
Thanks for the answer. At first I'm planning on testing with directional lights, but also intend do dabble into point and cone lights too. Thanks for the tip!
← Return to shader
Comments
Log in with itch.io to leave a comment.
I also noticed that I get this error repeating over and over:
Draw failed due to invalid input layout
I realise that this is due to the use of in_Normal in the fragment shader, but have I missed a step somewhere that prevents this error from happening? Unsure if it's related to the other issues I had.
This error means that the vertex format you’re using in your vertex buffer doesn’t contain all of the elements expected by the shader (which would be a 3D position, a 3D normal, a texture UV, and a color). If you don’t use the texture or the color you could edit the shader to ignore them, but otherwise you’ll have to make sure those values are included when you create the vertex buffer
Thank you!
I'm having issues with getting this working in my project, and wondered if there was something obvious that I missed?
When using any of the lighting options, it also draws light in the distance:
If I use fog, it stops drawing the floor:
It doesn't matter how close or far I draw the fog. This is the code I'm using in the draw event:
draw_clear(c_black);
var _ztilt = lengthdir_y(1, tilt);
var _lookz = z + _ztilt;
var _zmult = 1 - abs(_ztilt);
var _lookx = x + lengthdir_x(1, direction) * _zmult;
var _looky = y + lengthdir_y(1, direction) * _zmult;
view_mat = matrix_build_lookat(x, y, z, _lookx, _looky, _lookz, 0, 0, -1);
camera_set_view_mat(cam, view_mat);
gpu_set_ztestenable(true);
gpu_set_zwriteenable(true);
cluck_set_fog(true, #000000, 1, 320, 640);
cluck_set_light_ambient(c_black);
cluck_set_light_point(1, #EEAAFF, x, y, 160, 640);
cluck_apply(shd_cluck_fragment);
draw_3d_objects();
gpu_set_ztestenable(false);
gpu_set_zwriteenable(false);
gpu_set_cullmode(cull_noculling);
shader_reset();
Someone else ran into the lighting problem a few days ago, there seems to be something wrong with the specular reflection code that’s making the highlights appear in the wrong direction. For now if you disable that with cluck_set_spec_strength(0) it should work, I’m going to try to find out why it’s doing that.
For the fog, I’ve never seen that before. Can you send me a copy of the project?
That fixed it, thanks - I can send the project no problem, where would you like me to send it?
If you have a github repository you can send me the link or that, otherwise you can throw it on a google drive and send it to me here, or on bluesky or something if you don’t want the link open to the public
I've not set up a repo so I'll put it on drive and dm you on bluesky (just added you - I'm this guy https://bsky.app/profile/flashmoth.bsky.social )
Is normal mapping included in this project or not?
Im asking because in the demo project there is a way to activate or deactivate normal maps and im unable to find it in code.
Sorry for the delay, just got back from being away for a few days - there’s supposed to be, I might have to update the documentation and a few things like that, I’ll get back to you on that… hopefully soon
Okay, sorry for the delay, I probably should have dealt with this way sooner - the function cluck_set_normal_texture should take care of that, call it before you submit a vertex buffer (make sure to give it a texture ID and not a sprite)
Oh I see where I missed it.
I was working off the code in the file Sample Project - Chickens.yyz and the script was not included in there.
Thanks a lot,
Works like a charm.
Is this optimized for Android, Linux, and other versions in decompiling?
The first time I installed it on Android, it ran very slowly.
i’ve never ran it on Android, but in general you probably want to limit the number of lights on mobile hardware much more aggressively than you do on everything else
Would this work to light 2d Sprites with normal maps? Im building a 2.5D game with 2d Sprites and a perspective camera
In principle it should, I’ve never tried it though - that might be a fun experiment. If you’re using point or cone lights you’d have to be mindful of the exact depths that your sprites are drawing at.
Thanks for the answer. At first I'm planning on testing with directional lights, but also intend do dabble into point and cone lights too. Thanks for the tip!
Let me know how it goes!
Oh, and you’d also want to make sure the UV coordinates of the regular sprite and the normal mapped sprites are correctly aligned with each other.
Pretty cool stuff and easy to use. Only took me a few minutes to add this to my project :)
Have fun with it!
Nice example, and sorry to hear about your chicken. Thanks making this.
She was a good chicken :(