Category Archives: 3D

CRYENGINE – about Lua programming – part 1.

First I make this tutorial because lua language is used not only CryEngine …
Most game engines used this language programming.
Because I used the 64 bits into Cry Engine I will use the LuaCompiler from this folder :
C:\CRYENGINE\Bin64>LuaCompiler.exe
About Lua if you read the official website you will see this :
Lua is a powerful, fast, lightweight, embeddable scripting language.
Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping.

Also you can read about lua and windows OS here :
Now let’s make a simple example with this programming language.
First we need to deal with three file type: .cgf , .lua and .ent .
The .cgf cry engine file is a file will load into game.
The .lua file is a lua program file.
… and .ent file is a cry engine file ( entity file ).
So I make this files : test001.ent and test001.lua.
I save the test001.ent with this path : C:\CRYENGINE\GameSDK\Entities
and test001.lua come with this path: C:\CRYENGINE\GameSDK\Scripts\Entities\Physics
The content of the test001.ent:

The content of the test001.lua:

The next step is to open your Cry Engine Editor and will see your script working.
cryengine-test001
Now about the lua script ( test001.lua) is very simple to understand how it’s working.
First line is the name , in this case is test001.
All about this is store with {} and after that will come the functions: OnInit , OnReset and PhysicalizeThis.
Because all this functions come from test001 then the syntax is: test001:your_function() and will end with this word: end.
Also be advice about ; and , under Properties and after that is need to see how is the diff when we use:
self: and self.
All of this tips can be found if you read the test001.lua and try to understand that script.
Also you need to following prefixes on the value name…
Prefix Type
b – boolean
f – float
i – integer
s – string
clr – color
object_ – an object compatible with CryENGINE: a CFG, CGA, CHR or CDF file

You also can read this webpage.

Posted in 3D, All, Game engine, Programming, Windows 8. Tagged with , , , .

Working with GLFW library under Fedora.

Today I will try to use GLFW library.

GLFW is a C library that lets you using an OpenGL context and window, display modes and inputs like keyboard, mouse, joystick and time.

GLFW supports Windows, Mac OS X and Unix, Linux and FreeBSD and any operating systems with the X Window System.

Also you can read more about this library here.

First install the library using root account.

Now let’s see the source code.

First I includes all librarys I need.

In the main function I start to see if the library is working.

The next step is to set some settings, see:

… and also testing the desktop settings.

The settings it’s show on console with cout function.

Now I make the window context using fullscreen option.

I set the title of the window.

I enable the keys.

The next source code it’s close the window.

Testing with time command to see how fast working.

The netbeans IDE make the package in this path.

I make RPM package for Fedora distro.

I test my example and working well.

Posted in 3D, All, C++, Linux, OpenGL, Programming. Tagged with , , , , , .

Make your shadres online with SpiderGL – MeShader interface.

SpiderGL is a JavaScript 3D Graphics library which relies on WebGL for realtime rendering.

You can test it online using your browser using this website.

The website allow you to write shaders and also rendering the output.

About the web interface then has some windows to write your code and set the viewer.

See the next image:

meshade website

All steps show you how to use this web interface.

You need to load the 3D object using the Load button with this mesh: data/gargoyle1k.obj.

The website come with default example from shaders source code ( see step 2 and 3).

The steps 4 will apply the shaders and show on log windows if you got errors.

The step 5 will save your shaders.

Now about shaders source code.

If you want to use shader you need to have two source code: vertex shader source code and fragment shader source code.

The website interface come with two windows for each source code.

All two windowes need to have this source code in the top of each windows source code:

This tell shaders rendering about the data used by vertex and fragment shader.

This can be already declare in some engine scripting.

For example if you use Unity 3D engine then you can redefine VERTEX_P and FRAGMENT_P at the top of your shader file.

… where VERTEX_P and FRAGMENT_P it’s vertex and fragment shaders source code.

About Vertex Shader Source is the source code can be used to:

… is a set of attributes and functions performed by vertices and is responsible for running the vertex shaders.

About Fragment Shader Source is the source code can be used to:

… all the interpolated values computed in vertex shaders is used to code all effects that the application requires.

Also the fragment shader has no access to the frame buffer.

What do you know about shaders source code ?

Has one part of declarations like any programming language.

Also come with main function to run the shader.

The declarations is also like any language with variable , constants:

Uniforms are values which do not change during a rendering.

Attributes are only available in vertex shader and they are input values which change every vertex.

Varyings are used for passing data from a vertex shader to a fragment shader.

const this variables can be declared as const are compile-time constants and are not visible outside the shader that declares them.

If you know C language then the language syntax is C-like.

The default example from website :

The vertex shader

The fragment shader

Simple example I created using this website to show the normals.

Change this source code line from fragment shader:

The result rendering is:

meshade-002

You can see the object is fill with colors with x,y and z colors.

I will come with new tutorials about shaders.

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

Install povray and arbaro under Fedora .

Install povray-3.6

You need to download it from here.

Unarchive the povlinux-3.6.tgz in your user home folder.

Let’s install it. Press U and select /home/YOUR-USER/.povray. See the output.

As you see the YOUR-USER is your user.

Now , edit the config file to working with arbaro:

Make this settings:

Anyway seam the pov can be used. I set the arbaro folder to render png image.

Install arbaro

Download it from here.

Extract the files and folders into arbaro folder.

Use this command to run it.

As I told you : if the render image is not show in the pov then set the render into arbaro folder.

All the settings of the object tree can be make from the left panel.

Next we can see some images from arbaro.

arbaro povray fedora
arbaro povray fedora
arbaro povray fedora

Posted in 3D. Tagged with , , .

Alice – 3D educational programming environment – installation .

What is Alice?

The www.alice.org – official website provides a quick introduction.

Using an innovative 3D programming environment that makes it easy to create animations or games, the Alice Project seeks to provide tools and materials for a conceptual core of computational thinking, problem solving, and computer programming.
The Alice Suite of educational tools is designed to support teaching and learning across a spectrum of ages, grade levels, and classes in K-12 and in college or university courses.

You need to install jdk and jre from http://www.oracle.com.

Download from official website the installer: www.alice.org.

Make it executable.

See the content of the folder.

Run the script:

This is the first GUI window of installation program.

alice3 educational install linux

Select Alice application and press Next button.

alice3 educational install linux

Accept License Agreement.

alice3 educational install linux

The next step is : select folder for application.

alice3 educational install linux

Press Install button.

alice3 educational install linux

You will see progress of instalation.

alice3 educational install linux

After you can see the logs and details. Press Finish button.

alice3 educational install linux

Accept End User License Agreement.

alice3 educational install linux

This is first IDE for your to Select Project and allow you to select one template.

alice3 educational install linux

The IDE for develop your first project.

alice3 educational install linux

This is first tutorial to install Alice.

I will write more in the future. See you later.

Posted in 3D, Linux, Programming. Tagged with , , , .