Jump to content

Recommended Posts

Posted

Hello! Would it be possible in LE to draw only a part of the image on the screen (via context). I mean, let's say I have a 256 x 256 texture with four 64 x 64 frames. Now, I would like to be able to draw, for example, a part of the image with following specs: x = 64, y = 0, w = 64, h = 64.

 

I'm asking that because I'm building a basic 2d graphics lib and would like to implement animation in more elegant manner: right now, I'm just loading bunch of textures as frames, which is cumbersome and not quite efficient from renderer's point of view.

 

Thank you.

Posted

http://www.leadwerks.com/werkspace/topic/12537-drawing-a-section-of-a-2d-texture-setting-uv-coords/#entry90453

 

Thats how to draw part of an image, but I see you want to be able to easily animate the texture. I believe shadmar has posted a model shader that shows how to do this more effectively in his updated firepit script.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Posted

I've adapted your shader to my needs. However, I do not see how to clip the image: image just wraps. I see that you use "zoom" in order to clip the rest of the image. However, I want a non scaled part of the image. Any ideas?

 

Btw, I can't find Shadmar's shader that you're talking about. Could you please direct me where to find it?

Posted

@gamecreator Thank you! The mask will be very handy for my lib.

 

However, neither of what you've said does not correspond to my needs. Firstly, clamping only stretches the last pixel of the texture to it's borders. Secondly, Shadmar made a masking shader and not a shader to draw a part of the image. Althoug, I can use it for those needs, it's complicated and costly workaround. There should be a much simpler way.

Posted

The firepit in the workshop cycles 36 parts of one image to animate fire (spritesheet)

If you download it you can check the shader. I think it was called spritesheet.shader.

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Posted

@shadmar Thank you! Will try to decipher it, since I'm noob in regards to shaders smile.png

 

Anyway, can I (ab)use this opportunity to ask you what happens to your water prefab? I've downloaded it from here, but the water does not seem to move. Just sits there...

 

EDIT The water does not seem to like postprocessor effects. When I turn them off, everything is as expected. Is there a way to have a water with postprocessor effects?

Posted

Hmmm... Besides the water texture in Materials/Water folder, textures in Materials/Effects/Water and water shaders in Shaders/Water folder, I really don't see any prefab/entity/material that would be connected to water. And there is no tutorial how to make water. Could you give me, please, any lead?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...