wonderfl - build flash online

how to use CubeTexture?

Is there any document describing how to use CubeTexture? I even couldn't find such one on adobe's documentations.

codeonwort codeonwort

add to favorites

Embed

Code Fullscreen

Talk

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.

@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?

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).

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.>

Yes, if I understand fp11's cubemap truly, according to my own unofficial experiments. But most of the time, normal vectors are normalized.

thanks! now I think I can complete this task.

Sorry I have one big mistake. The v0 is NOT a normal vector on reflection. Its a reflective vector.

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

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.

Tags

sectKeywords

Forked

ページの先頭へ戻る