# Cubemap Problem (with pic)

This topic is 2650 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi guys,

I'm using a cubemap and the sides of my objects are only using the 'front' part of the map. This image shows what I mean:

The camera is at the origin looking straight down the positive z-axis. Notice how the sides of the sphere and cubes are white, the color of the 'front' part of the map (which is at the bottom of the image for reference.)

 // pixel shader part // passed view and normal are in world coordinates float3 V=normalize(input.view); float3 N=normalize(input.normal); float3 R=-reflect(V,N); float3 color=texCUBE(ReflectionMap,R).xyz; 

Am I doing something wrong ? Thanks a lot.

##### Share on other sites
Hidden
That's how it should work for a reflection. At the right side of the sphere, the normals will be close to (1, 0, 0). If your view vector is close to (0, 0, 1) (assuming +Z goes into the screen), then your reflection vector will be pointing in the direction of positive Z. Hence, you will sample the far side of the cube map.

looks correctly to me.

the side of the sphere is nearly 90degree to the view, it's nearly the same angle like e.g. a water plane would have in relation to the view. reflecting a ray on a plane that is nearly 90 degree to the view, will result in direction that just slightly changes -> still points to the white side of the cubemap.

if that's what confused you.

if you'd use the normal instead of the reflection vector, you'd just get the sides, if that's what you want.

##### Share on other sites
Thanks Krypton, now that you explained it I understand. I really thought I was doing something wrong.

1. 1
2. 2
Rutin
19
3. 3
4. 4
khawk
14
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633743
• Total Posts
3013644
×