Hi!
Is there a way for me to get the view-relative x,y position of the pixel into the shader code?
Shader position in viewSoftware: Away3D 4.x |
||
3dNewb, Sr. Member
Posted: 13 November 2012 07:03 AM Total Posts: 105 Hi! Is there a way for me to get the view-relative x,y position of the pixel into the shader code? |
||
GoroMatsumoto, Sr. Member
Posted: 13 November 2012 02:22 PM Total Posts: 166 [ # 1 ] Hi 3dNewb. What do you want to do with that? x in AS(0 ... view.width) : v0.x in AGAL(0 ... 1) So, you can access arbitrary coord of view in AGAL,
x=1.0/view.width*100.0; I put these in constant registers. If anybody know more easy or smart way,
|
||
3dNewb, Sr. Member
Posted: 13 November 2012 02:42 PM Total Posts: 105 [ # 2 ] I want to “fake” some material effects by making the material lighter near the center of the view. For this I need the position of the fragment pixel in the view. From your example I don’t understand what register I need to get the x,y position from…
|
||
GoroMatsumoto, Sr. Member
Posted: 13 November 2012 03:19 PM Total Posts: 166 [ # 3 ] center pos is (0.5, 0.5) in v0. At first, I convert coords,
//newCoords = coords - 0.5; Now you can access the center pos as (0, 0). And you use these num as effect power. If you want make center pixels bright,
//tempEffectPower = newCoords * effectPower Tested capture:
|
||
|
||
|
||
GoroMatsumoto, Sr. Member
Posted: 14 November 2012 12:40 AM Total Posts: 166 [ # 6 ] Sorry, I dont know what you want to do… Is first image correct? Non shaded cube?(like attached?) File Attachments SimpleAwayTest.swf (File Size: 178KB - Downloads: 243) |