Lunarovich Posted June 5, 2015 Share Posted June 5, 2015 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. Quote Link to comment Share on other sites More sharing options...
macklebee Posted June 5, 2015 Share Posted June 5, 2015 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. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Lunarovich Posted June 5, 2015 Author Share Posted June 5, 2015 Great! Many thanks! Quote Link to comment Share on other sites More sharing options...
Lunarovich Posted June 5, 2015 Author Share Posted June 5, 2015 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? Quote Link to comment Share on other sites More sharing options...
gamecreator Posted June 5, 2015 Share Posted June 5, 2015 Make sure you have clamp checked so it doesn't wrap http://www.leadwerks.com/werkspace/page/tutorials/_/textures-r6#section3.4 and here's shadmar's shader http://www.leadwerks.com/werkspace/topic/12237-2d-ui-masking/#entry88720 Quote Link to comment Share on other sites More sharing options...
Lunarovich Posted June 5, 2015 Author Share Posted June 5, 2015 @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. Quote Link to comment Share on other sites More sharing options...
shadmar Posted June 5, 2015 Share Posted June 5, 2015 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. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Lunarovich Posted June 5, 2015 Author Share Posted June 5, 2015 @shadmar Thank you! Will try to decipher it, since I'm noob in regards to shaders 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? Quote Link to comment Share on other sites More sharing options...
shadmar Posted June 5, 2015 Share Posted June 5, 2015 Just use the water that comes with LE? That old waterprefab isn't pp friendly (I think it says so where ever you downloaded it). Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Lunarovich Posted June 5, 2015 Author Share Posted June 5, 2015 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? Quote Link to comment Share on other sites More sharing options...
shadmar Posted June 5, 2015 Share Posted June 5, 2015 http://www.leadwerks.com/werkspace/page/tutorials/_/scene-panel-r3#section3 Section 3: Scene Panel, just enable water mode, adjust the height with the dialogs. 1 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Lunarovich Posted June 5, 2015 Author Share Posted June 5, 2015 Shame on me! Thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.