# Cubemap Problem (with pic)

This topic is 2348 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.