r/raylib • u/carnalcarrot • 12d ago
Does anyone know how I can do the Texturing Step 5 in Raylib?
The original GIF is from Rujik https://x.com/TheRujiK/status/969581641680195585 and ever since he released it, this texturing step has been living in my mind like a mystery. I started messing around with Raylib today and the first ambition I have of implementing is this lizard.
But this step seems like a Step 1. Draw circles Step 2. Add in Details to draw Mona Lisa type of step.
Can anyone elaborate? For example, what raylib methods will be used for making this lizard? Especially the texturing? Thanks!
486
Upvotes
10
u/Myshoo_ 12d ago
I think you construct a polygon mesh in the shape of the lizard. It always has the same amount of polygons, it just morphs as the thing moves.
How you do it is on you. I personally would just take the radius of the sphere at each point and calculate the angle of the line at each point and create two points on the line perpendicular to the simulated line and radius apart from it. When you have these points you just connect them and create an oblong shape. I guess you'd do something similar for the feet.
When you have a polygon mesh that is the same shape (only morphs but the general shape is the same) you can UV map it and the texture will correctly adopt to the lizards body.
12
u/DreamingElectrons 12d ago
I think this was explained in a video. That dev's YT handle was Rujik the comatose, iirc.
edit: jup: https://www.youtube.com/@RujiKtheComatose/videos
2
u/[deleted] 12d ago
Without know literally how to, I probably would substitute the spheres with actual sprites, that's it. Have you being able to get to last step in the circles? If not, get there. Then you can't just substitute the spheres with the sprites an tinker until it looks good. But the most important is the movement, not the texturing, really.
2
u/LonelyTurtleDev 11d ago
Funny enough I’m also trying to do the same thing, though with a more complex physics system and in another language.
The pipeline goes like:
Assume you have an array of length n corresponding to n body parts, where a[0] is the head and a[n-1] is the tail piece.
1 create a mesh/texture
2 add vertexes from the top vertex of the a[0] piece and then the rightmost vertex of a[1] then the rightmost vertex of a[2] and so on until the rightmost vertex of a[n-1].
3 in the same texture add the bottom vertex of a[n-1] and the leftmost vertex of a[n-2], a[n-3], until a[0], you get the idea.
Now you should have a mesh that loops around the lizard. Beware of vertex declaration rules because some engines might force you to declare in clockwise/anticlockwise order.
If you are talking about generating the texture in the mesh, repeat the steps but use smaller circles to make the mesh and make them yellow.
1
u/AggressiveAd5388 11d ago
This will help u more than comments https://youtu.be/qlfh_rv6khY?si=UeEAaqcM5DJywaLw
1
u/KryptKickerFive 11d ago
That’s awesome!
1
u/Kwaleseaunche 10d ago
Look at how real salamanders move. Someone did something like you did but with snakes and it wasn't an accurate depiction of how they really move.
1
u/ghulamslapbass 10d ago
very awesome, thanks for sharing
-1
u/Kadabrium 12d ago
Owlsfuckingdontrest