cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <canvas id="omega" width="800px" height="600px"/>
<img src="https://threejs.org/examples/textures/cube/skybox/px.jpg" crossOrigin = 'Anonymous'/>
<img src="https://threejs.org/examples/textures/cube/skybox/nx.jpg" crossOrigin = 'Anonymous'/>
<img src="https://threejs.org/examples/textures/cube/skybox/py.jpg" crossOrigin = 'Anonymous'/>
<img src="https://threejs.org/examples/textures/cube/skybox/ny.jpg" crossOrigin = 'Anonymous'/>
<img src="https://threejs.org/examples/textures/cube/skybox/pz.jpg" crossOrigin = 'Anonymous'/>
<img src="https://threejs.org/examples/textures/cube/skybox/nz.jpg" crossOrigin = 'Anonymous'/>

<img src="https://threejs.org/examples/textures/UV_Grid_Sm.jpg" crossOrigin = 'Anonymous'/>
<img src="https://threejs.org/examples/textures/lava/lavatile.jpg" crossOrigin = 'Anonymous'/>


            
          
!
            
              /**
 * OMEGA 3D Framework - http://lab.rackdoll.nl/js/omega/
 * v.0.0.1.8.1 Alpha - Sexy Fresnel Reflection Demo.
 * author: Rackdoll.
 */

var images, skybox_images, renderer, cam, scene ;
var chain, fresnel, DCT;
var objects = [];


function timeout() {
  setTimeout(function() {
    init();
  }, 500);
}

function init(){
   
    var imgs = document.getElementsByTagName("img");
    onLoadDone(imgs);
  
}

function onLoadDone(imgs){
  images = imgs;  
  skybox_images = [ images[0], images[1], images[2], images[3], images[4], images[5]];
  

  //adjust on window
  Omega3D.Recalibrate();

  //scene
  scene = new Omega3D.Scene();
  scene.setColor(0, 0, 0);
  
  

  //camera.
  cam = new Omega3D.cameras.Camera();
  cam.ratio = OMEGA.Omega3D.GL.viewPortWidth / OMEGA.Omega3D.GL.viewPortHeight;
  cam.LookAt(0, 0, 0, [0, -3, -5]);
  
  
  
  //light.
 var light = new Omega3D.Light(Omega3D.POINT_LIGHT);
  light.SetAmbient( 0.4, 0.4, 0.4);
  light.SetDiffuse( 0.6, 0.6, 0.6);
  light.SetPosition( 0, -6, 0 );
  light.SetRadius( 90.0 );
  scene.addLight(light);

  
  // SKYBOX
  var skybox_geom  = new Omega3D.Geometry.CubeGeometry(100.0, 100.0, 100.0);
  var skybox_tex   = new Omega3D.CubemapTexture(images);
  var skybox_mat   = new Omega3D.SkyBoxMaterial([skybox_tex], scene );
  var skybox       = new Omega3D.Object3D(new Omega3D.Mesh(skybox_geom), skybox_mat);
  scene.addChild( skybox );

  
  //OBJECT.
   DCT          = new Omega3D.DynamicCubemapTexture(images, 1024, 1024);
   var color        = new Omega3D.BasicTexture(images[6]);
   var geom         = new Omega3D.Mesh( new Omega3D.Geometry.SphereGeometry(1.25, 75.0,75.0) );
   var fresnel_data = { scale:"1.25", power:"1.0",minimum:"0.0",  color:"1.0, 1.0, 1.0"};
   var shader       = new Omega3D.Shaders.FresnelReflection( scene,fresnel_data );
   var mat          = new Omega3D.Material( shader, [DCT, color]);
   fresnel      = new Omega3D.Object3D( geom, mat );
   
    //set position.
    fresnel.SetPosition( 0.0, 0.0, 0.0);
    scene.addChild( fresnel );
  
   //objects.
   var smell_geom = new Omega3D.Mesh( new Omega3D.Geometry.SphereGeometry(0.5, 15.0,15.0) );
   var small_mat  = new Omega3D.BasicMaterial( [new Omega3D.BasicTexture(images[7])], scene, [1.0, 0, 0]);
   var step = Math.PI * 2.0 / 6;
   for( var i = 0; i < 6; i++){
       objects.push( new Omega3D.Object3D( smell_geom, small_mat ));
       objects[i].SetPosition( Math.cos(i*step ) * 3, 0, Math.sin(i*step) * 3);
       scene.addChild( objects[i] );
   }

   
  
  
  
  //create render chain.
  renderer = new Omega3D.WebGLRenderer;

  //Normal Rendering.
  var chain = new Omega3D.RenderChain();
  chain.AddRenderPass(new RenderPass(renderer, scene, cam));
  renderer.SetRenderChain(chain);

  //start render.
  render();
}

//RENDER.
function render() {
  requestAnimationFrame(render);
  
  //offste camera.
  var t = scene.getTime() * 0.5;
  var step = Math.PI * 2.0 / 6;
  for( var i = 2; i < scene.children.length; i++){
       scene.children[i].SetPosition( Math.cos(t + i*step ) * 3, 0, Math.sin(t + i*step) * 3);
   }
  
  cam.LookAt( 0, 0, 0,[Math.cos(t * 0.25) * 0.5, -5 + Math.cos(t * 0.35) * 3, Math.sin(t * 0.5) * 5.0]);
  
  //rotate fresnel.
  fresnel.Rotate( 0.005, 0.01, 0 );
  
  //set dynamic cubemap object to non renderable.
  fresnel.mayRender = false;


  //update faces dynamic cubemap.
  // 1. From Object Position.
  // 2. Renderer.
  // 3. Scene To Render.
  DCT.UpdateFaces(fresnel.GetPosition(), renderer, scene );


  //set dynamic cubemap object to renderable.
  fresnel.mayRender = true;

  
  //render step.
  renderer.render();
}

document.getElementsByTagName("body")[0].onload = timeout();
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console