- Forked from:
- codeonwort's stage3D base
how to use CubeTexture?
Is there any document describing how to use CubeTexture? I even couldn't find such one on adobe's documentations.
- forked:1
- favorite:0
- lines:115
- license : MIT License
- modified : 2011-12-18 17:27:01
I heard that CubeTexture requires mipmaps.
- by
9balls
- at 2011/11/19 10:19:45
You have to create all levels of mipmap image in CubeTexture, and refer it with "mipmaplinear" or "mipmapnearest" option in fragment shader.
The line 382-402 of http://wonderfl.net/c/vpLs may help you.
- by
keim_at_Si
- at 2011/12/05 11:20:16
@keim_at_Si I found that tex code would like this:
tex ft0, v0.xyz, fs0 <cube,linear,mapnearest>
Could you let me know in this tex code what value each should take or will take?
- ft0 : what value it will take? a pixel color?
- v0 : in case of 2d texture, the texture's uv coord takes this place. what value this register should contains?
- by
codeonwort
- at 2011/12/15 15:34:48
The ft0 is a picked up color from cube texture, and the v0 is the direction vector from cube center (this vector should not be normalized).
Let's say, the v0 is just a normal vector of the face (in the reflection rendering).
- by
keim_at_Si
- at 2011/12/15 19:21:10
I cannot sure If I understood right. is following sentence correct?
<if v0.xyz = (1, 0, 0), it directs the center of positiveX surface of cube. Then I will get the color value of that position. and it is ok if v0.xyz = (1.5, 0, 0) or (3.1, 0, 0) becuase both case v0.xyz indicates same direction.>
- by
codeonwort
- at 2011/12/15 19:35:23
Yes, if I understand fp11's cubemap truly, according to my own unofficial experiments. But most of the time, normal vectors are normalized.
- by
keim_at_Si
- at 2011/12/15 20:26:35
thanks! now I think I can complete this task.
- by
codeonwort
- at 2011/12/15 20:34:24
Sorry I have one big mistake. The v0 is NOT a normal vector on reflection. Its a reflective vector.
- by
keim_at_Si
- at 2011/12/16 00:06:30
Then in my above question v0.xyz = (-1, 0, 0) gives me positiveX center? and I have one more question(sorry to bother you with many questions.) when I put this code, rendering fails silently without any compile error or runtime error. I did not use 'tex' operation in my fragment shader. just calling setTextureAt() makes trouble.
context.setTextureAt(0, tex) // line 126
- by
codeonwort
- at 2011/12/17 14:30:53
The v0.xyz = (-1, 0, 0) gives negatiive X center.
sorry I dont have enough time to verify. but context3D.enableErrorChecking = true may give some information about silent errors.
- by
keim_at_Si
- at 2011/12/17 22:47:00


