Category Archives: 3D

Blender 3D – add modifier: Boolean .

Today I will show you how to use add modifier boolean.
First start with your Blender 3D software – I used the 2.77a version.
I used two cylinders with 16 vertices , radius 1.00 and depth 2.00.
I rename the first cylinder – Hole_Cylinder and this will be the surface of the hole.
The next cylinder is named – Surface_Cylinder and will be the result of this modifier.
Into Object Mode , select first Hole_Cylinder and then with key Shift select Surface_Cylinder.
Go to Add Modifier and select Boolean, and then with Difference over Object – Hole_Cylinder will make the hole.
See the next image to understand how is working.
cylinder_boolean

Posted in 3D, All, Blender 3D. Tagged with , , , , .

WebGL – simple shader example.

This is a simple webgl shader example.
I used a simple HTML5 example with one canvas.
The canvas has named glscreen. The next step is to put one java script with one var named buffer.
The buffer var is used for one array. The Float32Array typed array represents an array of 32-bit floating point numbers.
This var come with this source code into init function.

buffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
gl.bufferData(
gl.ARRAY_BUFFER,
new Float32Array([
-1.0, -1.0,
1.0, -1.0,
-1.0,  1.0,
-1.0,  1.0,
1.0, -1.0,
1.0,  1.0]),
gl.STATIC_DRAW
);
We can see also we have two functions: init and render and this:

var gl;
var canvas;
var buffer;

window.onload = init;
I put also two default shaders for vertex and fragment.
I use some vars for this into init function:

var shaderScript;
var shaderSource;
var vertexShader;
var fragmentShader;

This is the script:

<!DOCTYPE html>
<head>
<title>WebGL – Hello World!</title>
</head>
<body>
<script type=”text/javascript”>
var gl;
var canvas;
var buffer;

window.onload = init;

function init() {
var shaderScript;
var shaderSource;
var vertexShader;
var fragmentShader;

canvas        = document.getElementById(‘glscreen’);
gl            = canvas.getContext(‘experimental-webgl’);
canvas.width  = 640;
canvas.height = 480;

gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
buffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
gl.bufferData(
gl.ARRAY_BUFFER,
new Float32Array([
-1.0, -1.0,
1.0, -1.0,
-1.0,  1.0,
-1.0,  1.0,
1.0, -1.0,
1.0,  1.0]),
gl.STATIC_DRAW
);

render();

}

function render() {

window.requestAnimationFrame(render, canvas);

shaderScript = document.getElementById(“2d-vertex-shader”);
shaderSource = shaderScript.text;
vertexShader = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(vertexShader, shaderSource);
gl.compileShader(vertexShader);

shaderScript   = document.getElementById(“2d-fragment-shader”);
shaderSource   = shaderScript.text;
fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
gl.shaderSource(fragmentShader, shaderSource);
gl.compileShader(fragmentShader);

program = gl.createProgram();
gl.attachShader(program, vertexShader);
gl.attachShader(program, fragmentShader);
gl.linkProgram(program);
gl.useProgram(program);
gl.clearColor(0.0, 0.0, 0.0, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT);

positionLocation = gl.getAttribLocation(program, “local_position”);
gl.enableVertexAttribArray(positionLocation);
gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);
gl.drawArrays(gl.TRIANGLES, 0, 6);
}
</script>
<script id=”2d-vertex-shader” type=”x-shader/x-vertex”>
attribute vec2 local_position;
void main() {
gl_Position = vec4(local_position, 0, 1);
}
</script>
<script id=”2d-fragment-shader” type=”x-shader/x-fragment”>
void main() {
gl_FragColor = vec4(gl_FragCoord.x / 640.0, gl_FragCoord.y / 480.0, 0, 1);
}
</script>
<canvas id=”glscreen”></canvas>
</body>
</html>
The result is this:

shader001

Posted in 3D, All, HTML 5, javascript, Programming, WebGL. Tagged with , , , , .

Blender 3D – hologram effect.

I did not write a tutorial with Blender 3D for a while. Today I used version 2.77 to create a hologram effect tutorial. This tutorial use a simple cube and one plane with subdivision. Just use default scene with cube add a new plane. The next steps are to use TAB key to edit object and W key to select Subdivide. Make this for plane and cube object.
To create the hologram effect you need to select render with Cycles.
Now add one material on Cube and select material to Transparent BSDF.
Open your Node Editor and using Shift+A keys to create this nodes:
hologram effect node blender3d
and the result wil be this:
3D hologram

Posted in 3D, All, Blender 3D. Tagged with , , , , .

Unity 3D with Visual Studio 2015 IDE.

Most of the time I used Mono IDE for Unity 3D.
Today I show you how to use Unity 3D with Visual Studio 2015.
You need to know this solution it’s a little slow but can solve another issues for development.
Some settings we make from start to the end will come with restart of both IDE.
Let’s start with the first step:
First install Visual Studio 2015 from here.
You need to know about the the Visual Studio : it’s on Windows OS only.
Now download Visual Studio Tools for Unity from Unitytools Visual Studio and install this download.
If your instalation will come with Repair just repair it.
This repair option it’s show you when the Visual Studio it’s install with Unity 3D package.
Open your Unity software and make this settings from Unity Preferences ( first menu of Unity 3D software).
Unity_Visual_Studio_tutorial_001
Duble left click to run the Visual Studio Tools for Unity from folder where you put the download.
Unity_Visual_Studio_tutorial_002
Select all and then accept this settings.
Unity_Visual_Studio_tutorial_003
You have one new folder add Assets into your project. You need to make more settings because will not working yet.
Make one new C# script and named it. I used the name : test. Start to develop your script by open this script.
Unity_Visual_Studio_tutorial_004
When you start your development of this script the Visual Studio 2015 start also.
Unity_Visual_Studio_tutorial_005
Now use right click mouse button to add Existing Item… or use the short key.
Unity_Visual_Studio_tutorial_006
Add the DLL files from your Unity 3D project ( Assets -> UnityVS folders).
Unity_Visual_Studio_tutorial_007
Try to build your solution from Visual Studio. Also check the settings of thise two DLL from Unity 3D by left click and check your options. If you got errors then restart both IDE: Visual Studio 2015 and Unity 3D.
This will fix all your imports and settings files.

Posted in 3D, All, Unity 3D, Visual Studio, Windows 10. Tagged with , , , , , .

Blender 3D – using nodes – part 001.

Compositing is used quite frequently in Blender to make rendering faster, add images, make distortions, make the render look more realistic, and much, much more. Used with nodes – an entirely different way of visualizing the graphical programmable shaders , 3d and rendering.
First open your Blender 3D and go to : Compositing.
blender3d_nodes_001
In this tutorials I just show you how to deal with nodes. So you need to set your render and / or your material object from scene and will deal with that. You can used Shift+A keys to add your nodes.
blender3d_nodes_002
You can select one node or multiple nodes if you use the Shift key.
If you have many nodes then you can use M keys to mute the selected node.
This will bypass the entire node / nodes and will reconnect the first with the next node.
The Ctr+X keys will delete the node / nodes .
The Alt+D will disconnect the node.
If you want to duplicate your node / nodes just use Shift+D keys.
You can duplicate your node / nodes with your connections then use : Ctr+Shift+D .
Some connections will be the same from one node to many nodes.
You can put together with this:
– select your nodes connected and then drag with your mouse over connection with CTR key pressed, see this next steps :
blender3d_nodes_003

Posted in 3D, All, Blender 3D. Tagged with , , , , .