- Home /
Unity3d render texture based on position
im currently trying to create a container in unity with multiple quads inside, and am looking for a way to stop parts of the quad that fall outside of the containers bounds from being rendered?
Also i just spent twenty minutes trying to fiqure out how to explain the problem properly(and failed) so created this pretty picture instead. the red line represents the bounds with the black squares representing my textured quads.
EDIT after more googleing i see that this ngui example of a scroll bar that show the effect i am trying to create. http://www.tasharen.com/ngui/example7.html
Answer by RPGstandard · Jul 30, 2013 at 10:39 AM
Setup a Prefab with a script the renders the texture to the game object while it is within the bounds of the container, and destroys the object or whatever you want to do with it, if it goes out of these bounds.
http://docs.unity3d.com/Documentation/ScriptReference/RenderTexture.html
unfortunately it doesnt seem possible to only render half the texture this way, happy to be proven wrong though
I was thinking you wanted each quad to have its own texture.
each quad will have its own texture, however at times i will nee to be able to see only half of the quad
What I would try to do then is create a function that will calculate the visible part of the quad and then sample the texture and apply the area of the texture that would be visible to the quad.
Your answer
Follow this Question
Related Questions
[ShaderGraph] How can I prevent lights overlapping in intensity? 0 Answers
How can i change detail texture? 1 Answer
How to change a value in custom shader through script, C# 1 Answer
Changing Emission Scale UI with Script 0 Answers
Is it possible to create a shader that emits light into the world? 0 Answers