Showing posts with label escher. Show all posts
Showing posts with label escher. Show all posts

Sunday, November 8, 2009

House Of Stairs

English    Spanish

Today I'm going to show a set of renders that although they are not totally finished I would like to show.
The target is the representation in 3D of the picture "House Of Stairs" of M.C.Escher. I focused the representation of walls and stairs. The strange animals and the doors are missing.

The results are these, in black and white and in color:


In the color version I have simply used blackbody illuminants with temperatures of 3000, 4000, 5000 and 7000 Kelvin.

In order to make the renders we have to do this. It's necessary to model the scenery in such a way so the dimensions fit using whole units (fitting into a grid). So we make sure that all walls, walkways and stairs have similar widths. With any CAD program it's possible to model the scenery looking the original drawing. The objects at this point have box geometry.



Because the rendering of boxes is too dull we have to add some effects. One of those has to emulate the round shape of a stone. In order to achieve that we can use textures or 3D models. In this case I preferred using 3D models to achieve more quality. Accomplishing this is simple. We cubicate the scene with the same resolution of the design grid. Now we have a set of voxels. Each voxel is replaced by a rounded cube mesh shape. The only problem is the amount of data and so the high processing time.



Later we apply a material to the surface. For that is used a composite material. The material is composed by one control map and two data maps. The control material is used to decide the amount of blending between the data materials. It's similar to an alpha blending. For the control map I have used a binary threshold discretized Perlin noise function. In the high part I have assigned one kind of bumpmap and in the lowest part another kind. So, two bumpmaps of controllable independent characteristics are obtained. Now we simply apply a greater scale factor and noise to one to look like holes in stone, while applying a smoother noise to the other. With only one bumpmap would have achieved a smoothed and polished stone effect with some holes. We don't want it.



Finally to render it's used a cylindrical camera to emulate the curved effect of "The House of Stairs". With a little wise we can place the camera more or less the same position where Escher sat it.

Sunday, August 2, 2009

Spherical Renders of Labyrinths

English    Spanish

Recently I was thinking about how one of the mazes that I programmed would it seen using a spherical lens. Spherical lens deform parts of the images that are away from center, so the things that are far away looks like further away indeed. So more things "fits" inside the image.
When the deformation is low the result is similar to a wide angle lens. When the deformation is high we get images more dificult to achieve in reality. When the deformation is very high the images are imposible to obtain in reality.
The code that generates a particular ray for a pixel can be coded like this:


Ray RayGenerator::GenerateRay(int pixel_x, int pixel_y)
{
Ray ray;
double u,v;

ConvertPixel_to_Unit(pixel_x,pixel_y,u,v);

ray.orig=From;
ray.dir=-Normalize3d(-i + u*tanFov*aspect*j + v*tanFov*k);

return ray;
}

This code generates rays that advance in the negative direction of the X axis

Slightly modifying the code we can obtain our new spherical camera:

Ray SphericalRayGenerator::GenerateRay(int pixel_x, int pixel_y)
{
Ray ray;
double u,v;

ConvertPixel_to_Unit(pixel_x,pixel_y,u,v);

u*=fishEyeFactor*aspect;
v*=fishEyeFactor;

Vector V;
double r=sqrt(u*u+v*v);

double a=atan2(v,u);
V.y=sin(a)*(1-cos(r));
V.z=-cos(a)*(1-cos(r));
V.x=sin(r);
V=Normalize3d(V);

Matrix matrix=Construct4d(i,j,k,VECTOR3D(0,0,0));
V=TransformVector3d(V,matrix);

ray.orig=From;
ray.dir=Normalize3d(V);

return ray;
}

This type of projection generates a pole (or singularity) in the positive direction of the X axis. This generates images wery similar to the ones that Escher made in Circle Limit. As we aproach to the horizon we go to infinity.
With the value 'fishEyeFactor' we replicate the plane several times over the sphere reaching infinity as concentrical circular shapes.

This image is a normal render of an infinite labyrinth:


As we increase the spherical factor we slightly deform the image:


If we increase too much the factor we reach infinity several times:


We can make a render looking "down" obtaining an image that remainds quite well to the ones of M.C.Escher:


Likewise it's possible to increase the spherical factor:

Thursday, January 8, 2009

Lattice Object

El otro día estuve mirando un libro de Escher que tengo desde hace tiempo. Hojeándolo llegué hasta uno de los dibujos que siempre me había sorprendido por su regularidad: "Cubic Space Division" . Este dibujo se puede representar a mano con un poco de paciencia, cosa que les sobra a las computadoras. Así, que decidí realizar un pequeño programa que representara escenarios parecidos a ese dibujo.

Cómo mostrar el espacio sin más es aburrido, decidí representar un enrejado acotado por la superficie de un objeto. Para ello utilicé una herramienta que codifiqué hace más o menos un año. La herramienta (una clase en C++) determina si un punto está dentro o fuera de un objeto cerrado. Esta herramienta se pensó para determinar el volumen de un objeto amén de utilizarse para obtener otras interesantes características como el tensor de inercia del sólido rígido que representaría. Para determinar el volumen, normalmente se eligen puntos aleatorios acotados dentro de una superfice que engloba el objeto y se haya una relación entre los que están dentro y los totales. Si esta relación se multiplica por el volumen acotado de la superficie englobante tenemos una aproximación del volumen. Estas técnicas de integración numérica son muy útiles cuando es muy complicado o imposible obtener una función analítica que represente la función de superficie que se desea integrar.

Para realizar este modelo simplemente hay seleccionar puntos equiespaciados en los tres ejes espaciales y almacenar los que están dentro del objeto a analizar. Analizando la vecindad de los nodos (ver si tiene vecinos en los tres ejes y sus dos direcciones) se pueden añadir empalmes que parejas de éstos. Es necesario elegir cautelosamente los tamaños de los nodos y de los empalmes para que el armazón no englobe todo el espacio.

Dejo por aquí algunos renders. Una vista interior:

Otras exteriores...



Y una exterior más de cerca: