Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8933147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:28:16+00:00 2026-06-15T09:28:16+00:00

I was able to make some nice metal and glass looking materials by using

  • 0

I was able to make some nice metal and glass looking materials by using Skybox Cube / environment mapping.

I have made my own controls which allow one to both orbit and move/look around like in FirstPersonControls.

The problem is, the reflections look convincing when I move around – I can see the reflections move and change accordingly to my camera movement. However when I look around (rotate the camera / change it’s target), there is no change in the reflections, they are just static.

I can see the same behaviour in for example three.js/examples/webgl_materials_cubemap_escher.html – if I modify it to use FirstPersonControls, the material does not look reflective/refractive at all when I look around.

Here’s how I setup the cubemaps, to be honest it’s copied from some example and I don’t understand all of it. But it works, except for this one issue…

createSkyBox = function(urlPrefix) {
var sceneCube = new THREE.Scene();
var path = urlPrefix;
var format = '.jpg';
var urls = [
    path + 'px' + format, path + 'nx' + format,
    path + 'py' + format, path + 'ny' + format,
    path + 'pz' + format, path + 'nz' + format
  ];

var reflectionCube = THREE.ImageUtils.loadTextureCube( urls );
reflectionCube.format = THREE.RGBFormat;

var refractionCube = new THREE.Texture( reflectionCube.image, new THREE.CubeRefractionMapping() );
refractionCube.format = THREE.RGBFormat;


// Skybox

var shader = THREE.ShaderUtils.lib[ "cube" ];
shader.uniforms[ "tCube" ].value = reflectionCube;

var material = new THREE.ShaderMaterial( {

  fragmentShader: shader.fragmentShader,
  vertexShader: shader.vertexShader,
  uniforms: shader.uniforms,
  depthWrite: false,
  side: THREE.BackSide

} );
var size = 8000;
mesh = new THREE.Mesh( new THREE.CubeGeometry( size, size, size ), material );
mesh.geometry.computeBoundingBox();
sceneCube.add( mesh );

this._threejs_cube_scene = sceneCube;
this._threejs_cube_mesh = mesh;
this._threejs_envmap = reflectionCube;
this._threejs_envmap_refraction = refractionCube;

this._threejs_scene.add( sceneCube );  
}

And here’s the way I create the material:

var material = new THREE.MeshLambertMaterial( { color: 0xff00, ambient: 0xaaaaaa, envMap: this._threejs_envmap});

I then use the material in renderer.overrideMaterial (I’m using EffectComposer, if it makes any difference)

EDIT: now that I think about it, I’m not sure.. my brain melts.. it might be how the real life works 🙂 At least intuitively when I see the code in action, the staticness while rotating camera doesn’t feel right. But maybe it’s because in real life it’s hard to look around (eye.lookAt()) without also moving ever so slightly (eye.position = xyz).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:28:17+00:00Added an answer on June 15, 2026 at 9:28 am

    you should calculate the reflection vector in world space (inside your code for ‘fragmentShader’ which you don’t show here). If it’s in object space, or view (camera) space, it won’t move naturally.

    Yes, this may mean some finagling with the surface normals. To convert object space normals to world space normals, use the inverse transpose of the world matrix. You’ll also need to get the view vector in worldspace coordinates in order to calculate the final worldspace reflection vector.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want the user to be able to make some preferences like colors, prefered
I need to be able to be able to make some text on terminal
I have been able to make my photos large for single photo posts on
I want to be able to make a line graph using GTK+ but I'm
I have some questions about how you set up your development environment. I'm running
I have to make some animated design with lots of pretty effects and color
I have been using ActiveResource in my Ruby on Rails applications for some time,
I'd like to make some empty hidden elements (iframes would be nice, paragraphs would
I am blind, and I have trouble making nice looking guis. This really frustrates
I am not able to make the nested elements sortable in jQuery UI. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.