+
1
|
list
|
skin
|
login
|
editor
α-wwwiki
::
raytrace
user:none
(4977 bytes)
_h1 raytrace {span {@ style="font-size:0.5em;"} (see also page [[pForms]])} _h3 gallery {center {lightbox {@ height="460" width="600"} (http://epsilonwiki.free.fr/lambdaway_2.0/data/lambdaray_20130329/d3.jpg nine spheres on a checkerboard) (http://epsilonwiki.free.fr/lambdaway_2.0/data/lambdaray_20130329/a.jpg 8 little spheres for the unit cube) (http://epsilonwiki.free.fr/lambdaway_2.0/data/lambdaray_20130329/b.jpg the unit room with a mirror) (http://epsilonwiki.free.fr/lambdaway_2.0/data/lambdaray_20130329/bc.jpg sphere patches around a black sphere in the unit room) (http://epsilonwiki.free.fr/lambdaway_2.0/data/lambdaray_20130329/bg.jpg three textures : mire, amelie, lustucru) (http://epsilonwiki.free.fr/lambdaway_2.0/data/lambdaray_20130329/c.jpg sphere patches around a black mirror sphere) (http://epsilonwiki.free.fr/lambdaway_2.0/data/lambdaray_20130329/d1.jpg nine spheres on a checkerboard, eight of glass, one dark polish metal) (http://epsilonwiki.free.fr/lambdaway_2.0/data/lambdaray_20130329/d2.jpg nine spheres on a checkerboard, eight of glass, one dark polish metal) (http://epsilonwiki.free.fr/lambdaway_2.0/data/lambdaray_20130329/e.jpg grid bitmapped on a planar and a spherical patches) (http://epsilonwiki.free.fr/lambdaway_2.0/data/lambdaray_20130329/f.jpg a spherical patch with a checker map) (http://epsilonwiki.free.fr/lambdaway_2.0/data/lambdaray_20130329/g.jpg two bitmap textures and one spatial texture) }} _h3 try by yourself {center {canvas {@ id="raycanvas" width="400"; height="400"; style="background:#ffe; border:1px dashed black; box-shadow:0 0 24px black; "}} _p 1) include the 3D libraries : {input {@ type="submit" value="include lambdaray" onclick="°° var js = document.createElement('script'); js.src = 'plugins/lambdaray.js'; document.body.appendChild( js ); this.value = 'OK, lambdaray is included !'; this.disabled='disabled'; °°"}} {input {@ type="submit" value="include lambdaray_tests" onclick="°° var js = document.createElement('script'); js.src = 'plugins/lambdaray_tests.js'; document.body.appendChild( js ); this.value = 'OK, lambdaray_tests is included !'; this.disabled='disabled'; °°"}} _p 2) play with the parameters : zoom: {input {@ id="zoom" value="1.0" style="background:#ccc; width:40px; text-align:center;"}} x0: {input {@ id="x0" value="0.0" style="background:#ccc; width:50px; text-align:center;"}} y0: {input {@ id="y0" value="0.0" style="background:#ccc; width:50px; text-align:center;"}} refl: {input {@ id="reflect" value="0" style="background:#ccc; width:30px; text-align:center;"}} model: {input {@ id="model" value="d" style="background:#ccc; width:30px; text-align:center;"}} {pre {@ id="info"}-} {input {@ type="submit" value="load model" onclick="°° RAY.model_begin(); var model = getId( 'model' ).value; if (model.match( 'a' )) unit_cube(); if (model.match( 'b' )) room(); if (model.match( 'c' )) gyroscope() if (model.match( 'd' )) spheres_array( 3 ); if (model.match( 'e' )) patches(); if (model.match( 'f' )) lustucru(); if (model.match( 'g' )) eye(); RAY.add_light( {X:-0.25, Y:0.40, Z:-0.25} ); RAY.add_light( {X: 0.25, Y:0.40, Z:-0.25} ); RAY.add_light( {X:-0.25, Y:0.40, Z: 0.25} ); RAY.add_light( {X: 0.25, Y:0.40, Z: 0.25} ); RAY.model_end(); °°"}} then {input {@ type="submit" value="render scene" onclick="RAY.doUpdate();"}} } _h3 defining shapes and loading the model _ul 1) in the model field enter a letter or a couple of letters, as they appear in the frame below, for instance : _ul30 "a" is for the unit_cube(), "b" is for the room(), and so on, _ul30 it's possible to play with more then one model, like this : "bc" is for the room() + the gyroscope() _ul 2) then click on "1) load model" button and on "2) render scene", and wait the end of rendering ... _ul 3) for each chosen model, try different values : _ul30 in the refl field (number of reflections), say 1, 2, 3 _ul30 in the zoom field, say 0.5 or 2.0 _ul30 in the x0 and y0 fields, say from -0.5 to +0.5 {pre {@ style="border:1px dashed black; box-shadow:0 0 24px black; "}°° RAY.model_begin(); var model = getId( 'model' ).value; if (model.match( 'a' )) unit_cube(); if (model.match( 'b' )) room(); if (model.match( 'c' )) gyroscope() if (model.match( 'd' )) spheres_array( 3 ); if (model.match( 'e' )) patches(); if (model.match( 'f' )) lustucru(); if (model.match( 'g' )) eye(); RAY.add_light( {X:-0.25, Y:0.40, Z:-0.25} ); RAY.add_light( {X: 0.25, Y:0.40, Z:-0.25} ); RAY.add_light( {X:-0.25, Y:0.40, Z: 0.25} ); RAY.add_light( {X: 0.25, Y:0.40, Z: 0.25} ); RAY.model_end(); °°} _h3 code _p The raytrace's code is visible here : _ul [[lambdaray core|plugins/lambdaray.js]], _ul [[lambdaray tests|plugins/lambdaray_tests.js]]