Posts

Showing posts with the label voxels

Generating seamless repeated 3D-textures (repeated voxel objects)

When creating 3D textures (voxel objects), it's may be required to make it "seamless repeated", that means that if the textures placed joined together, the gap between them are smooth (invisible). For example, it's useful for filling the whole 3D space with repeated texture in a raymarching-based project. Hint: Such whole 3D space filling by a repeated 3D texture gives feeling of repeating in the space and may be desirable. But, if you need to eliminate such repeatng feeling, for example, for rendering clouds using 3D-texture, you may mix two same textures but with different scales (1 and 1.2225) and shifted. Maximal color -  max(texture1, texture2) works good for the clouds. Here we explain method for making any 3D texture (voxel object) seamless repeated. Note, the resulted object will be smaller due this procedure. It's based on idea of mixing border voxels with changed mixing value. Normally such technique is used for creating smooth music lo...

Using 3D texture in OpenGL/openFrameworks with programmable pipeline

Here we explain how to work with 3D textures using modern OpenGL, verson >= 3.2, using C++ code with openFrameworks. For preparing this text we used several sources: https://stackoverflow.com/questions/13459770/glsl-sampler3d-in-vertex-shader-texture-appears-blank https://en.sfml-dev.org/forums/index.php?topic=23871.0 https://community.khronos.org/t/opengl-3-x-glenable-gl-texture-2d-gl-invalid-enum/61405 https://github.com/tiagosr/ofxShadertoy We will performs the folliwing steps to create and 3D texture for openFrameworks 0.10.1: 1. Enable programmable pipeline 2. Define the function for printing GL errors 3. Create some volume data 4. Create and upload 3D texture 5. Setting 3D texture to shader 6. Create shader files 1. Enable programmable pipeline Be sure you are using programmable pipeline, so in main.cpp, main() use the following code: int main() {     ofGLWindowSettings settings;     se...

Raymarching in Shadertoy, openFrameworks and Unreal Engine

Raymarching is a special method of rendering 3D objects or 3D scene: It's used for rendering ocean water, clouds, metaballs in Unreal Engine 4 and other engines and 3D editors. It's a main technique used for rendering 3D in Shadertoy projects. Examples Shadertoy projects of rendering generative volumes, clouds, ocean and skybox reflections: Sculpture III by iq: https://www.shadertoy.com/view/XtjSDK , see more at http://www.iquilezles.org/www/articles/raymarchingdf/raymarchingdf.htm https://www.shadertoy.com/view/MsfGRr https://www.shadertoy.com/view/lss3zr https://www.shadertoy.com/view/XslGRr https://www.shadertoy.com/view/llsXD2 https://www.shadertoy.com/view/XsB3Rm stochastic ray trace by Otavio Good https://www.shadertoy.com/view/WlfXRr  Metaballs and volumetric clouds in Unreal Engine 4: https://www.youtube.com/watch?v=ZbLCIcTHup4 https://www.youtube.com/watch?v=hWNX9jGEt8k Claybook game is made entirely in similar technique: https://www.youtube.com/...