tag:blogger.com,1999:blog-23246743173661739642024-03-15T18:09:41.849-07:00Voxel Game Engine DevelopmentSparse Voxel Octree Raycasting based Game Development.Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.comBlogger104125tag:blogger.com,1999:blog-2324674317366173964.post-79167013518282547062019-01-21T22:27:00.001-08:002019-01-21T22:34:25.273-08:00Update - Situation not resolved (Beware the poisons Levofloxacin, Ciprofloxacin)<br />
Some asked me if it got better - actually it got worse. After just 3 pills I can barely walk and got a nephrotic syndrome in addition.. Be aware of Fluoroquinolones and never take them !!<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-PW1yFLE-1m4/XEa3Pq0tMtI/AAAAAAAAHHA/we_BswyPX8cBpuYrXuVApIGl_dE9j5z8gCLcBGAs/s1600/IMG_20190101_000533.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="899" data-original-width="1227" height="467" src="https://4.bp.blogspot.com/-PW1yFLE-1m4/XEa3Pq0tMtI/AAAAAAAAHHA/we_BswyPX8cBpuYrXuVApIGl_dE9j5z8gCLcBGAs/s640/IMG_20190101_000533.jpg" width="640" /></a></div>
<br />
Btw, Fluoroquinolones are r<a href="https://www.fda.gov/downloads/AboutFDA/WorkingatFDA/FellowshipInternshipGraduateFacultyPrograms/PharmacyStudentExperientialProgramCDER/UCM550259.pdf">esponsible for most antibiotic caused disabilities</a> - but thats not what they tell you when you get the prescription. They say its well tolerated.<br />
<br />
Brief addition: This blog uses Cookies for Google Analytics und AdSense. According to EU law, I need to state this on the page.<br />
<br />
<br />Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com2tag:blogger.com,1999:blog-2324674317366173964.post-57407607532326458282016-06-22T08:52:00.003-07:002016-11-08T06:26:23.176-08:00Side effects of Antibiotics (Levofloxacin, Ciprofloxacin) forced me to put dev on hold<span style="font-size: large;">I got side effects of antibiotics (levofloxacin,ciprofloxacin) and am currently not able to continue the voxel development. Once it gets better I will resume.</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">Be warned: Those antibiotics have delayed severe, sometimes permanent, side effects and damage nerves, eyes, ears, tendons, heart, muscles, joints and bones. While you take the medicine everything is fine, but weeks later tendons, muscles and joints start to hurt so you can barely move. The package insert says it occurs 1:10000, but my doctor honestly said every 100th patient of him has issues with it.</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">You can help to make other ppl aware of this danger by sharing and signing this petition (German)</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">Main points are:</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">* Germany/better Europe should get a black box warning like US</span><br />
<span style="font-size: large;">* Restrict use to life-threatening situations</span><br />
<span style="font-size: large;">* Drugs to treat these side effects need to be researched</span><br />
<span style="font-size: large;">* Tests for testing adverse reactions from blood or DNA samples need to be developed</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;"><a href="https://weact.campact.de/petitions/warnung-und-eingeschrankter-einsatz-fur-chinolone-antibiotika" target="_blank">https://weact.campact.de/petitions/warnung-und-eingeschrankter-einsatz-fur-chinolone-antibiotika</a></span><br />
<br />
<a href="http://www.fluorchinolone-forum.de/">http://www.fluorchinolone-forum.de/</a>Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com3tag:blogger.com,1999:blog-2324674317366173964.post-65862001592103083722016-04-08T02:35:00.004-07:002016-04-08T02:36:54.313-07:00Planet Rendeing : Recursive Level of Detail, With Code<span style="font-size: large;">Today I present you a level of detail algorithm for planet rendering. It has merely 100 lines of C++.</span><br />
<span style="font-size: large;"><br /></span>
<a href="https://github.com/sp4cerat/Planet-LOD"><span style="font-size: large;">https://github.com/sp4cerat/Planet-LOD</span></a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-VIA6xO4ssyI/Vwd7YgB0PII/AAAAAAAADeM/XKfW-8ESEOAI5ffezFRSIawhUWvxTQbxg/s1600/planet.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="630" src="https://3.bp.blogspot.com/-VIA6xO4ssyI/Vwd7YgB0PII/AAAAAAAADeM/XKfW-8ESEOAI5ffezFRSIawhUWvxTQbxg/s640/planet.png" width="640" /></a></div>
<br />
<br />
<br />
<br />
<br />Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-29246286768191543712016-03-19T17:26:00.001-07:002016-03-19T17:26:20.846-07:00Basic NetworkingBasic Networking working. So far without any physics & voxels. Running server + 4 clients @60fps on my Notebook simultaneously.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-mO0N0auxP_8/Vu3uHg-EJeI/AAAAAAAADbc/RbIOs4zNPyU6Oql9rav1cO08g5lWL-3ZA/s1600/Clipboard01.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="490" src="https://2.bp.blogspot.com/-mO0N0auxP_8/Vu3uHg-EJeI/AAAAAAAADbc/RbIOs4zNPyU6Oql9rav1cO08g5lWL-3ZA/s640/Clipboard01.png" width="640" /></a></div>
<br />Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-88482575832742473672016-02-25T15:33:00.005-08:002016-04-12T23:33:19.882-07:00OutStar Demo (Pre-Akpha)<span style="font-size: large;">This is a pre-alpha of OutStar - Enjoy.</span><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: large;"><img border="0" height="315" src="https://1.bp.blogspot.com/-7K67uEOG2Zk/Vs-OzuYpeUI/AAAAAAAADYc/nfBEG6r_Rf4/s400/61.jpg" width="560" /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<center><iframe width="560" height="315" src="https://www.youtube.com/embed/tUyz-22KyXw" frameborder="0" allowfullscreen></iframe></center><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: x-large;"><a href="http://outstar.net/files/OutStarPreAlpha.zip" target="_blank">Download</a></span></div>
<br />
<u><span style="font-size: large;"><br /></span></u>
<u><span style="font-size: large;">It contains three modes:</span></u><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">1. The game mode (no shooting so far, just walk around)</span><br />
<span style="font-size: large;">2. Block edit (toggle with tab)</span><br />
<span style="font-size: large;">3. Sculpt editor (toggle with middle mouse button)</span><br />
<u><span style="font-size: large;"><br /></span></u>
<u><span style="font-size: large;">Controls:</span></u><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">F1 Screenshot</span><br />
<span style="font-size: large;">F2 Toggle Fullscreen</span><br />
<span style="font-size: large;">F3 Game/Edit Mode</span><br />
<span style="font-size: large;">F4 Sculpt Mode</span><br />
<span style="font-size: large;">F5 Save Level</span><br />
<span style="font-size: large;">F6 Load Level</span><br />
<span style="font-size: large;">F7..F10 Set Resolution 1024x512..1920x1080</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">TAB Toggle Edit/Game Mode</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">Space Jump</span><br />
<span style="font-size: large;">wsad Move Player</span><br />
<span style="font-size: large;">Shift Run</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">Game Mode:</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">LMB : Will be shoot</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">Edit Mode:</span><br />
<span style="font-size: large;">LMB set block</span><br />
<span style="font-size: large;">MMB Toggle Sculpting Tool</span><br />
<span style="font-size: large;">RMB delete block</span><br />
<span style="font-size: large;">Wheel: change block</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">Hold the LMB/RMB and drag to set a larger area</span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">In sculpting tool:</span><br />
<span style="font-size: large;">Add block to octree : adds a new block to the available list</span><br />
<br />
<br />Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-70384371429132818202015-11-03T15:41:00.004-08:002015-11-03T15:45:04.340-08:00Game-Net: Simple RPC System for Games (C++11)<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px;">
<strong style="box-sizing: border-box;">Summary</strong></div>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px;">
The library provides basic client / server network functionalities for games using RPCs. The major strength of the library is the template based RPC class. It allows to register and call RPCs effortless. It further includes a tutorial game server and game client (each around 300 lines of code ) for a very simple multiplayer shooting game as a proof of concept.</div>
<div style="box-sizing: border-box; margin-bottom: 16px;">
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><span style="line-height: 17.0667px;"><a href="https://github.com/sp4cerat/Game-NET">https://github.com/sp4cerat/Game-NET</a></span></span><br />
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://github.com/sp4cerat/Game-NET/raw/master/screenshots/game.png?raw=true" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="208" src="https://github.com/sp4cerat/Game-NET/raw/master/screenshots/game.png?raw=true" width="320" /></a></div>
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><br /></span>
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><br /></span>
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><br /></span>
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><br /></span>
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><br /></span>
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><br /></span>
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><br /></span>
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><br /></span>
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><br /></span>
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><br /></span>
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><br /></span>
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><br /></span></div>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px;">
<strong style="box-sizing: border-box;">Network RPC Lib Features</strong></div>
<ul style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px; margin-top: 0px; padding: 0px 0px 0px 2em;">
<li style="box-sizing: border-box;">Register RPCs in one line. The RPC class autodetects all paramters from the function pointer</li>
<li style="box-sizing: border-box;">RPC Data-type mismatch or wrong number of parameters are stated as error to ease debugging</li>
<li style="box-sizing: border-box;">Numbers are automatically sent as the smallest possible datatype (byte, short , .. )</li>
<li style="box-sizing: border-box;">Supports GLM datatypes for use in 3D Games</li>
<li style="box-sizing: border-box;">Supported Datatypes : (u)char,(u)short,(u)int,float,double,vector,map, GLM vec,mat and quat</li>
<li style="box-sizing: border-box;">Support for nested Datatypes like map [ string , vector ]</li>
<li style="box-sizing: border-box;">Reliable and unreliable calls possible</li>
<li style="box-sizing: border-box;">Function pointers of remote functions are not required</li>
<li style="box-sizing: border-box;">Based on ENet</li>
<li style="box-sizing: border-box;">Tested on Cygwin, Linux (Ubuntu) and Windows</li>
<li style="box-sizing: border-box;">C++11 based</li>
</ul>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px;">
<strong style="box-sizing: border-box;">Network RPC Lib Limitations</strong></div>
<ul style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px; margin-top: 0px; padding: 0px 0px 0px 2em;">
<li style="box-sizing: border-box;">RPCs cannot be class member functions</li>
<li style="box-sizing: border-box;">No compression</li>
<li style="box-sizing: border-box;">No encryption</li>
<li style="box-sizing: border-box;">Only void functions supported. Non-void functions were tested but complicated everything.</li>
<li style="box-sizing: border-box;">Client to Client connections are not supported</li>
</ul>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px;">
<strong style="box-sizing: border-box;">Example Game Features</strong></div>
<ul style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px; margin-top: 0px; padding: 0px 0px 0px 2em;">
<li style="box-sizing: border-box;">Lobby</li>
<li style="box-sizing: border-box;">Multiple Games</li>
<li style="box-sizing: border-box;">Handle spwaning/removing of game objects</li>
<li style="box-sizing: border-box;">Simple Shooting functionality</li>
<li style="box-sizing: border-box;">Intentionally textmode for simplicity</li>
</ul>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px;">
<strong style="box-sizing: border-box;">Benchmark</strong></div>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px;">
A first simple test on localhost (Core i7 Notebook) gave:</div>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px;">
1 Call / Network Update:</div>
<ul style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px; margin-top: 0px; padding: 0px 0px 0px 2em;">
<li style="box-sizing: border-box;">69.000 unreliable RPC calls/sec [client.call_ex(0,"hello_server", "Greetings")]</li>
<li style="box-sizing: border-box;">74.000 reliable RPC calls/sec [client.call_ex(1,"hello_server", "Greetings")]</li>
</ul>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px;">
10 Calls grouped / Network Update</div>
<ul style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px; margin-top: 0px; padding: 0px 0px 0px 2em;">
<li style="box-sizing: border-box;">144.000 unreliable RPC calls/sec [client.call_ex(0,"hello_server", "Greetings")]</li>
<li style="box-sizing: border-box;">310.000 reliable RPC calls/sec [client.call_ex(1,"hello_server", "Greetings")]</li>
</ul>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px;">
20 Calls grouped / Network Update</div>
<ul style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px; margin-top: 0px; padding: 0px 0px 0px 2em;">
<li style="box-sizing: border-box;">142.000 unreliable RPC calls/sec [client.call_ex(0,"hello_server", "Greetings")]</li>
<li style="box-sizing: border-box;">364.000 reliable RPC calls/sec [client.call_ex(1,"hello_server", "Greetings")]</li>
</ul>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px;">
Note that this is not about the response time</div>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px;">
<strong style="box-sizing: border-box;">Example Usage</strong></div>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px;">
Call Server Function:</div>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px;">
Client Side:</div>
<pre style="background-color: #f7f7f7; border-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; font-stretch: normal; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; word-wrap: normal;"><code style="background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; max-width: initial; overflow: initial; padding: 0px; word-break: normal; word-wrap: normal;">NetClient client;
void set_pos(vec3 pos)
{
// do something
exit(0);
}
int main()
{
rpc_register_remote(client.get_rpc(), login);
rpc_register_local(client.get_rpc(), set_pos);
client.connect("localhost", 12345);
client.call("login", "myname", "pass");
while(1) client.process();
//client.disconnect();
}
</code></pre>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 17.0667px; margin-bottom: 16px;">
Server Side:</div>
<pre style="background-color: #f7f7f7; border-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; font-stretch: normal; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; word-wrap: normal;"><code style="background: transparent; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; line-height: inherit; margin: 0px; max-width: initial; overflow: initial; padding: 0px; word-break: normal; word-wrap: normal;">NetServer server;
void login(uint clientid, string name, string password)
{
// clientid is the first parameter for server functions
server.call(clientid, "set_pos", vec3(1,2,3));
}
int main()
{
rpc_register_local(server.get_rpc(), login);
rpc_register_remote(server.get_rpc(), set_pos);
server.start();
core_sleep(10000) ; // wait client to do stuff
server.stop();
}</code></pre>
Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-47594491205047156512015-07-28T10:24:00.001-07:002015-07-28T10:24:09.494-07:00Github CodeI shifted some of my code to GITHUB. You can find it here <a href="https://github.com/sp4cerat">https://github.com/sp4cerat</a>Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com1tag:blogger.com,1999:blog-2324674317366173964.post-80407432387389118842015-07-15T17:36:00.005-07:002015-07-17T02:27:28.586-07:00OpenGL Game GUI / Widgets with Source Code (C++)<div>
<span style="font-family: Verdana, sans-serif; font-size: large;">The GUI is intended for PC and/or Console Games. </span><br />
<span style="font-size: large;">
<span style="font-family: Verdana, sans-serif;">Focus was mostly on keeping everything simple, easy to use, fast, and flexible (like having skin and ttf support).</span></span><br />
<span style="font-size: large;">
<span style="font-family: Verdana, sans-serif;">The performance is ~700 fps for 20 windows and </span><span style="font-family: Verdana, sans-serif;">100 fps for 100 windows on a Notebook PC </span><span style="font-family: Verdana, sans-serif;">(NVidia GTX 765 / Core i7 2.4). </span></span><br />
<span style="font-size: large;"><span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">The source (MIT license) can be downloaded </span><a href="https://github.com/sp4cerat/Game-GUI" style="font-family: Verdana, sans-serif;" target="_blank">from GitHUB </a><span style="font-family: Verdana, sans-serif;">or </span><a href="http://raycast.org/data/GameGui.2015.07.16.zip" style="font-family: Verdana, sans-serif;" target="_blank">here</a><span style="font-family: Verdana, sans-serif;">. </span></span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">
</span>
<br />
<div style="background-color: white; line-height: 18.2000007629395px; margin: 0px 0px 0.75em;">
<u><span style="font-family: Verdana, sans-serif; font-size: large;">Usage examples:</span></u><br />
<div style="font-size: 14px;">
<u><span style="font-family: Verdana, sans-serif; font-size: medium;"><br /></span></u></div>
</div>
<div style="background-color: white; line-height: 18.2000007629395px; margin: 0px 0px 0.75em;">
<span style="font-family: Verdana, sans-serif; font-size: large;">Creating and opening a window:</span><span style="font-family: Verdana, sans-serif; font-size: x-large;"> </span><br />
<code class="csharp plain" style="background-attachment: initial !important; background-clip: initial !important; background-color: transparent; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 15.3999996185303px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;"><br /></code>
<span style="font-size: large;"><code class="csharp plain" style="background-attachment: initial !important; background-clip: initial !important; background-color: transparent; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 15.3999996185303px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;">gui.window["mywin"]=Gui::Window(</code><code class="csharp string" style="background-attachment: initial !important; background-clip: initial !important; background-color: transparent; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 15.3999996185303px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;">"Hello World"</code><code class="csharp plain" style="background-attachment: initial !important; background-clip: initial !important; background-color: transparent; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 15.3999996185303px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;">,100,100,350,250);</code></span><br />
<code class="csharp plain" style="background-attachment: initial !important; background-clip: initial !important; background-color: transparent; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 15.3999996185303px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;"><span style="font-size: x-large;"><br /></span></code></div>
<div style="background-color: white; line-height: 18.2000007629395px; margin: 0px 0px 0.75em;">
<span style="line-height: 18.2000007629395px;"><span style="font-family: Verdana, sans-serif; font-size: large;">Adding a button:</span></span><br />
<code class="csharp plain" style="background-attachment: initial !important; background-clip: initial !important; background-color: transparent; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 15.3999996185303px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;"><span style="line-height: 15.3999996185303px;"><br /></span></code>
<span style="font-size: large;"><code class="csharp plain" style="background-attachment: initial !important; background-clip: initial !important; background-color: transparent; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 15.3999996185303px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;"><span style="line-height: 15.3999996185303px;">gui.window["mywin"]</span>.button[</code><code class="csharp string" style="background-attachment: initial !important; background-clip: initial !important; background-color: transparent; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 15.3999996185303px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;">"Ok1"</code><code class="csharp plain" style="background-attachment: initial !important; background-clip: initial !important; background-color: transparent; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 15.3999996185303px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;">]=Gui::Button(</code><code class="csharp string" style="background-attachment: initial !important; background-clip: initial !important; background-color: transparent; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 15.3999996185303px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;">"OK"</code><code class="csharp plain" style="background-attachment: initial !important; background-clip: initial !important; background-color: transparent; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 15.3999996185303px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;">,20,100,60,20);</code></span><br />
<code class="csharp plain" style="background-attachment: initial !important; background-clip: initial !important; background-color: transparent; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; height: auto !important; left: auto !important; line-height: 15.3999996185303px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;"><span style="font-size: x-large;"><br /></span></code></div>
<span style="font-family: Verdana, sans-serif; font-size: large;">Adding a callback to close the window when pushing the button:</span><br />
<code class="csharp plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;"><code class="csharp plain" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 14px; height: auto !important; left: auto !important; line-height: 15.3999996185303px; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="line-height: 15.3999996185303px;"><br /></span></code></code><code class="csharp plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-size: large; line-height: 15.3999996185303px;">gui.window["<span style="color: blue;">mywin</span>"].button["<span style="color: blue;">Ok1</span>"].callback_pressed=</span></code><br />
<code class="csharp plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-size: large; line-height: 15.3999996185303px;"> [](Gui::Window *w,Gui::Button* b,int index) { w->close(); };</span></code><br />
<code class="csharp plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: inherit !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><br /></code><span style="font-size: large;"><br /></span>
<span style="font-family: Verdana, sans-serif; font-size: large;">Here two screenshots with different skins</span><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-t63wnGK5GVs/VacTyd7xqYI/AAAAAAAADLQ/QCgYieaEQHU/s1600/gui2.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="394" src="http://3.bp.blogspot.com/-t63wnGK5GVs/VacTyd7xqYI/AAAAAAAADLQ/QCgYieaEQHU/s640/gui2.png" width="640" /></a></div>
</div>
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-4lnjgPbagso/Vab2a8ZHyAI/AAAAAAAADLA/q6HsvshxsDw/s1600/gui.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="500" src="http://2.bp.blogspot.com/-4lnjgPbagso/Vab2a8ZHyAI/AAAAAAAADLA/q6HsvshxsDw/s640/gui.png" width="640" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<span style="font-family: Verdana, sans-serif;"><a href="http://i.imgur.com/piMots7.png" target="_blank">Screenshot1 large</a> <a href="http://i.imgur.com/RXKUZ6G.png" target="_blank">Screenshot2 large</a></span><br />
<span style="font-family: Verdana, sans-serif;"><b><br /></b><b><span style="font-size: large;"><a href="http://raycast.org/data/GameGui.2015.07.16.zip" target="_blank">DIRECT DOWNLOAD</a> </span></b></span><br />
<span style="font-family: Verdana, sans-serif;"><b><span style="font-size: large;"><br /></span></b>
<b><span style="font-size: large;"><a href="https://github.com/sp4cerat/Game-GUI" target="_blank">GITHUB Repository</a></span></b></span></div>
<div>
<div style="-webkit-text-stroke-width: 0px; color: black; font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">
<div style="font-size: medium;">
<div style="margin: 0px;">
<span style="font-family: Verdana, sans-serif;">( VS2012 / OpenGL / GLUT based / MIT license )</span></div>
</div>
</div>
</div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif; font-size: large;"><b>Features:</b></span><br />
<ul>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Advanced skin scaling: define how the inner and borders of a texture shall be scaled ( simple scale, repeating inner pattern or constant outer frame, carried out by 3 Shader types)</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">UTF8 Support</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">TTF Support</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Easy skinning support</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Alpha support (RGBA), so you can have transparent windows/widgets etc</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">direct access to all controls and their members</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Non-blocking visualization</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Callback support</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Different from most GUIs, Widgets are stored directly inside the GUI rather having local variables pointing to instances of an overwritten class.</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Directory: Controls are stored and accessed by a tree structure that is rendered every time like a scene graph</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">No event loop, show function or update function</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">No need to have a timer that calls an update function</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Lightweight: Only Depends on GL and libFreetype and DevIL</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Can easily be used in SDL, Qt and other environments. Just plug in the keyboard and mouse events and call the gui's draw function from your main render loop.</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Config file support for default variables (font,padding etc) and skin textures+scaling parameters</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Only 2000 lines of code for the entire Gui class including all widgets. Therefore easy to modify and extend.</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Comes with a simple file-browser (See screenshot1)</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">MIT license</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Multi-screen support (same as multiple Desktops). You can have a title screen, loading screen, ingame screen etc. Simply create them at the beginning and the switch between by setting gui.active_screen=number;</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Window manager</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Context menu</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Custom mouse pointer</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Controls have support for custom user variables like control.var.string["myvar"]="hello"</span></li>
</ul>
<b><span style="font-family: Verdana, sans-serif; font-size: large;">Available classes for controls:</span></b></div>
<div>
<ul>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Window class</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Label class</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Button class</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Combo class</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Radio class</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Tab class</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Textedit class</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Slider class</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">CheckBox class</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Menu class</span></li>
</ul>
</div>
<div>
<span style="font-family: Verdana, sans-serif; font-size: large;"><b>What the GUI is good for:</b></span></div>
<div>
<ul>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">PC/Console Games</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Simple menus</span></li>
</ul>
</div>
<div>
<span style="font-family: Verdana, sans-serif; font-size: large;"><b>What the GUI might not be suited for</b></span></div>
<div>
<ul>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Complex GUIs that need tree-views , docking ,drag & drop etc</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Mobile Devices ; perhaps too slow (needs testing) and also the render code needs to become OpenGL ES</span></li>
</ul>
</div>
<div>
<span style="font-family: Verdana, sans-serif; font-size: large;"><b>Current Limitations (might be solved in the future)</b></span></div>
<div>
<ul>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Uses old OpenGL (glMatrix etc)</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Usually one or two render calls per widget rather than one opengl render call for the entire gui.</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">2D windows/widgets only. You could overwrite the render shader to get 3D, but you would have to map 2D mouse coordinates to 3D then by yourself. </span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">No animations (you could create them yourself by updating the textures accordingly or modifying the shader that render the widgets)</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Only one font size and one font type</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">The GUI class is a singleton</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">The TextEdit does not support arbitrary cursor position or ctrl+c/v/x operations</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">Drag and Drop is not supported</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">No automatic window layout</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">No docking</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">No Ressource files (yet)</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">No treeview class</span></li>
<li><span style="font-family: Verdana, sans-serif; font-size: large;">No caching of rendered labels, geometry, etc. Therefore every frame, the entire tree is traversed and every single character of a rendered text is processed for rendering.</span></li>
</ul>
<div>
<span style="font-family: Verdana, sans-serif;">The usage is also described in the <a href="http://voxels.blogspot.de/2015/07/opengl-game-gui-development-alpha-demo.html" target="_blank">previous post</a>.</span></div>
</div>
<div>
<span style="font-family: Verdana, sans-serif; font-size: large;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif; font-size: large;"><b>The code used to create window + widgets + menu in screenshot2 is the following:</b></span></div>
<div>
<br /></div>
<pre class="brush: csharp"> gui.init( Gui::Flags::CONTEXT_MENU | Gui::Flags::CUSTOM_MOUSE ,
"../data/gui_global.txt" ,
"../data/gui_skin.txt");
// Main Window
Gui::Window w=Gui::Window("Hello World",100,100,350,250);
// Add Simple Label to Window
w.label["l"]=Gui::Label("Label",20,70,100,20);
// Add Simple Button to Window
w.button["Ok1"]=Gui::Button("OK",20,100,60,20);
w.button["Ok1"].callback_pressed=
[](Gui::Window *window,Gui::Button* control,int index)
{
window->close();
};
w.button["Ok2"]=Gui::Button("",220,100,100,100);
w.button["Ok2"].skin=Skin( "../data/smiley.png",
"../data/smileybw.png",
"../data/smiley2.png");
// Add Simple Combo to Window
w.combo ["cb"]=Gui::Combo(120,100,60,20);
w.combo ["cb"].add_item("test");
w.combo ["cb"].add_item(L"東京");
w.combo ["cb"].callback_selected=
[](Gui::Window *w,Gui::Button* control,int index) // text entered callback example
{
Gui::Combo &c=*(Gui::Combo*)control;
w->label["l"].text=Gui::String( c.selected ) + " selected";
w->label["l"].textcolor=vec4f(1,0,0,1);
};
// Add Text Edit to Window
w.textedit["txt"]=Gui::TextEdit(10,"text",20,150,160,20);
w.textedit["txt"].callback_text_entered=
[](Gui::Window *w,Gui::Button* control,int index) // text entered callback example
{
Gui::TextEdit &t=*(Gui::TextEdit*)control;
w->title.text=t.text;
};
// Add Radio
w.radio["rad"]=Gui::Radio(20,190,20,20); // first button
w.radio["rad"].add_item(50,190); // second button
w.radio["rad"].add_item(80,190); // third button
w.radio["rad"].callback_pressed=
[](Gui::Window *w,Gui::Button* control,int index)
{
w->x+=10;
};
// Add Slider
w.slider["s1"]=Gui::Slider( 0,200,100, /* min,max,default*/
20,220,160,20); /* window x,y,sx,sy */
w.slider["s1"].callback_pressed=
[](Gui::Window *w,Gui::Button* control,int index)
{
Gui::Slider &b=*((Gui::Slider*) control);
w->button["Ok1"].text=Gui::String(int(b.val));
};
w.slider["s2"]=Gui::Slider( 0,200,100, /* min,max,default*/
350,100,20,160, /* window x,y,sx,sy */
Gui::Slider::VERTICAL );
// Add File Menu to Window
Gui::Menu m=Gui::Menu("File",/* x,y,sx,sy */ 9,39,50,20, /* menuwidth */ 100);
m.add_item("Load",
[](Gui::Window *window,Gui::Button* control,int index) // menu button callback
{
gui.screen[0].window["filebrowser"]= // open file dialog
gui_file_dialog( "Load SaveGame" , "Load" , "Cancel" ,
/*get_current_dir()*/ "..\\data\\win8",".png", 100,100,
// file dialog ok button callback
[](Gui::Window *w,Gui::Button* b,int index)
{
MessageBoxA(0,
w->textedit["Filename"].text.c_str() ,
w->label["dir"].text.c_str() ,0);
w->close();
}
);
});
m.add_item("Close",
[](Gui::Window *w,Gui::Button* control,int index) // menu button callback
{
w->parent->close(); // close window
});
m.add_menu("submenu");
m.window.menu[0].add_item("test1");
m.window.menu[0].add_item("test2");
w.menu["menu"]=m;
// Add new Window to Screen 0 (default)
gui.screen[0].window["hello1"]=w; // finally put window on the screen (1st copy)
// Modify and Add new Window to Screen 0 (default)
w.move(500,100);
w.resize(400,300);
w.minsize(150,150);
gui.screen[0].window["hello2"]=w; // finally put window on the screen (2nd copy)
// -------------------------------------------------------------------------
// also use our previous menu as context menu and file menu
// Note : "context_menu" is reserved for the context menu
// all other id names are common menus on the background
gui.screen[0].menu["context_menu"]=m;
gui.screen[0].menu["file"]=m;
gui.screen[0].menu["file"].y=5;
// -------------------------------------------------------------------------
// Add Button to Background
gui.dialog["sample"]=w; // store for later use in the callback
gui.screen[0].button["more"]=Gui::Button("More Windows Plz!!",50,50,200,20);
gui.screen[0].button["more"].callback_pressed=
[](Gui::Window *w,Gui::Button* control,int index) // menu button callback
{
int id=gui.screen[0].window.add(gui.dialog["sample"]);
gui.screen[0].window[id].x= timeGetTime() % (int)gui.screen_resolution_x;
gui.screen[0].window[id].y= timeGetTime() % (int)gui.screen_resolution_y;
};
// Add Tabbed Window to Background
Gui::Tab t=Gui::Tab("Win1",350,150,300,200,50,20);;
t.add_tab("Win2");
t.add_tab("Win3");
t.add_tab("Win4");
loopi(0,4)
{
t.window[i].button.add(Gui::Button("OK",20+i*10,20,60));
t.window[i].label["lab"] =Gui::Label("some text",20+i*20,90,100);
t.window[i].button["test2"]=Gui::Button("OK",100+i*10,20,60);
t.window[i].button["test3"]=Gui::Button("OK",50+i*10,50,60);
}
t.flags=Gui::Tab::MOVABLE; // Make it movable
gui.screen[0].tab["mytab"]=t;
</pre>
<br />
<br />
<br />
<span style="font-size: large;">Main reason for the development of the GUI was, that after trying several gui's more or less suited for games (LibRocket, Qt, NVWidgets, CEgui, etc), I found that none of them was really light weight, easy to use and fully skinable at the same time. So the solution was to create one which is exactly so. </span><br />
<span style="font-size: large;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-_uWC8ElGMCQ/Vab1Wx6XjmI/AAAAAAAADK0/cb7V9bm7gvI/s1600/58814384.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/-_uWC8ElGMCQ/Vab1Wx6XjmI/AAAAAAAADK0/cb7V9bm7gvI/s320/58814384.jpg" width="320" /></a></div>
<br />
<br />Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com2tag:blogger.com,1999:blog-2324674317366173964.post-47229935583840845792015-07-01T16:49:00.001-07:002015-07-01T17:18:45.216-07:00OpenGL Game GUI & Widget Development (Alpha Demo)<span style="font-size: large;">Today I am going to share some progress on my GUI project.</span><br />
<div>
<span style="font-size: large;"><br /></span>
<u><span style="font-size: large;">The Design Goals were:</span></u><br />
<ul>
<li><span style="font-size: large;">Simplicity : Create a control in one line</span></li>
<li><span style="font-size: large;">Easy Skinning support</span></li>
<li><span style="font-size: large;">TTF and UTF8 support</span></li>
<li><span style="font-size: large;">Directory : Controls can be accessed by a tree structure</span></li>
<li><span style="font-size: large;">Direct access of all data members like if a button is pressed e.g.</span></li>
<li><span style="font-size: large;">No Event Loop</span></li>
<li><span style="font-size: large;">Static non-blocking visualization</span></li>
<li><span style="font-size: large;">Dialog Templates from ressource text file</span></li>
<li><span style="font-size: large;">Callback support </span></li>
</ul>
<span style="font-size: large;"><br /></span>
<u><span style="font-size: large;">Some simple examples:</span></u></div>
<div>
<span style="font-size: large;">Creating a window: <b>gui.window["idname"]=Gui::Window("Title",100,100,250,350);</b></span></div>
<div>
<span style="font-size: large;">Closing a window: <b>gui.window.erase("idname");</b></span></div>
<div>
<span style="font-size: large;">Adding a button : <b>gui.window["idname"].button["load"]=Gui::Button("Load",20,20,50,30);</b></span></div>
<div>
<span style="font-size: large;"><br /></span></div>
<div>
<span style="font-size: large;">Change the skin of a window or other control:</span></div>
<div>
<div>
<span style="font-size: large;"><b>gui.window["idname"].skin=Skin(</b><b>"normal.png",</b><b>"hover.png",</b><b>"selected.png");</b></span></div>
</div>
<div>
<span style="font-size: large;"><br /></span></div>
<div>
<span style="font-size: large;">There is no need to create a variable for most cases. The GUI handles that for you. It will cover basic functions that a required in a game. Its not optimized for speed, yet fast enough in most cases.</span><br />
<span style="font-size: large;"><br /></span></div>
<div>
<span style="font-size: large;">You can fetch an alpha demo of the gui here : <a href="http://raycast.org/data/gui.alpha.demo.zip" target="_blank">[ DOWNLOAD ]</a></span></div>
<div>
<span style="font-size: large;"><br /></span></div>
<div>
<span style="font-size: large;">I will post more details soon.</span></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-GRriuhzsl5Q/VZR5aboF_oI/AAAAAAAADKE/923mLg862to/s1600/Clipboard03.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="505" src="http://1.bp.blogspot.com/-GRriuhzsl5Q/VZR5aboF_oI/AAAAAAAADKE/923mLg862to/s640/Clipboard03.png" width="640" /></a></div>
<div>
<br />
<br />
<br /></div>
Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-78260312701706099042015-05-27T04:01:00.003-07:002015-05-27T07:23:28.869-07:00Sparse Voxel Octree Raytracing based Occlusion Culling (Theory)I will share some thoughts on how the next generation of block based sandbox games rendering (triangle based) and creators pipelines might look like. In current games, overdraw is the most limiting factor when drawing high detailed scenes - that means, occlusions are not determined 100% accurate. Further, it is necessary to traverse some data structures on the CPU to create a list of objects to be rendered on the screen.<br />
<br />
To improve on this, here the proposal for a completely GPU based solution that uses octree raycasting to determine the visibility.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-jq1irBHLMNQ/VWWgxKpbmFI/AAAAAAAADIc/NwwbSLcf-tI/s1600/Clipboard05.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="190" src="http://3.bp.blogspot.com/-jq1irBHLMNQ/VWWgxKpbmFI/AAAAAAAADIc/NwwbSLcf-tI/s640/Clipboard05.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The first step is to raycast a low res, lets say 128x128 pixel, ID buffer, which takes about 1ms from experiments. This is fast and only used to determine the visibility. In a second step, we create a list of visible objects and further merge with the list of objects that were visible in the past few frames. The list is generated as input buffer for glmultidrawelementsindirect. The steps until now are performed on the GPU using multiple CL or GL compute kernels. The final step is to draw all object with one GL call. The raycasting and grouping of duplicate IDs on the screen can be performed best in opengl compute or opencl. To not miss out distant objects only occupying a few pixels, it is necessary to add jittering to the rays casted. The proposed technology will allow the use of high resolution blocks for sandbox games while the performance is high enough to run on notebooks at high frame rates.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The creation pipeline is as usual:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-Yphfewr1m3c/VWWi5oLoXdI/AAAAAAAADIo/4wWOzh2OOds/s1600/Clipboard06.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="186" src="http://3.bp.blogspot.com/-Yphfewr1m3c/VWWi5oLoXdI/AAAAAAAADIo/4wWOzh2OOds/s640/Clipboard06.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
First, sculpting / creating of the mesh as hi-res, then creating LODs+Normal maps using mesh simplification and transferring the details to a normal map.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Actually, there is already a similar method out there for a while called<a href="https://www.assetstore.unity3d.com/en/#!/content/6391" target="_blank"> instant OC</a>. It is not that effeciently integrated however. Its a script addon to Unity - yet, is uses raycasts to determine the visibility (1000-2000 have been the demo settings). </div>
Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-57750698884466413422015-05-21T03:48:00.002-07:002015-05-21T10:30:16.117-07:00Sparse Voxel Octree (SVO) Reprojection Raycast Tech-DEMO I decided to release a tech demo of the sparse voxel octree raytracing re-projection algorithm. Feel free to download and try it out. It uses OpenCL and should run on NVIDIA in any case. For ATI and INTEL HD I cannot guarantee. You might further need <a href="https://www.microsoft.com/en-us/download/details.aspx?id=30679" target="_blank">VS2012 redistributables 32 bit</a>.<br />
<br />
Usage:<br />
<br />
Mouse : Look around<br />
w,s,a,d,q,e : Move around<br />
Space : See the re-projected pixels (lower image)<br />
<br />
The algorithm raycasts only a fraction of pixels for each screen. Most are re-used from the previous frame exploiting frame-to-frame coherency, which allows a speed up of up to 4x. The algorithm is explained in more detail in a <a href="http://voxels.blogspot.com/2014/05/raycaster-speed-up-up-to-400-by-image.html" target="_blank">previous post.</a><br />
<div>
<br /></div>
<div style="text-align: center;">
<span style="font-size: large;"><a href="http://www.outstar.net/files/SVO-Reprojection-TechDemo.zip" target="_blank">DOWNLOAD SVO DEMO</a></span></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-kovRMNRfZLU/VV23yxx6w6I/AAAAAAAADH4/mqxPCMPaTMI/s1600/Clipboard01.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="332" src="http://3.bp.blogspot.com/-kovRMNRfZLU/VV23yxx6w6I/AAAAAAAADH4/mqxPCMPaTMI/s640/Clipboard01.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-RqBtbKaFig4/VV3ueqz1IgI/AAAAAAAADII/Zehv0-2_UJE/s1600/Clipboard02.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="334" src="http://3.bp.blogspot.com/-RqBtbKaFig4/VV3ueqz1IgI/AAAAAAAADII/Zehv0-2_UJE/s640/Clipboard02.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div>
<br /></div>
Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-1445086311346757702015-04-12T10:32:00.001-07:002015-04-15T13:07:35.475-07:00Work in Progress on Outstar (SSAO / Bugfixes)After a year, I finally found time to continue the development. Here a shot from a castle I built in about 1 day, including sculpting of some new blocks. Note that there are also rooms behind windows where you can walk around inside The new version also has a lot of bugfixes and now is getting closer to be ready for a demo release. SSAO (the lowermost image) is in progress, but not yet to my satisfaction. The complete castle's octree ist stored in 2.1MB on Hard disk. Title of the game will be Outstar. You can soon check out <a href="http://www.outstar.net/">http://www.outstar.net</a> . (The 20 fps in the screenshots is because I captured them on my notebook rather desktop PC)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-vW2ZCxlqquo/VSrCM0UxxmI/AAAAAAAADGM/iR3Vpb_eaZc/s1600/123.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-vW2ZCxlqquo/VSrCM0UxxmI/AAAAAAAADGM/iR3Vpb_eaZc/s1600/123.jpg" height="225" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-woQr8QGLmbY/VS7E9baSwcI/AAAAAAAADHA/BTMMqeRmzXY/s1600/Clipboard01.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-woQr8QGLmbY/VS7E9baSwcI/AAAAAAAADHA/BTMMqeRmzXY/s1600/Clipboard01.jpg" height="225" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-9VpxgFEHt2c/VS0IVO-nU-I/AAAAAAAADGc/Q8T5c000VZs/s1600/Clipboard01.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-9VpxgFEHt2c/VS0IVO-nU-I/AAAAAAAADGc/Q8T5c000VZs/s1600/Clipboard01.png" height="225" width="400" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-gflXH6TAJ64/VSqqxu-hEcI/AAAAAAAADFs/pvys679OzR4/s1600/castle.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-gflXH6TAJ64/VSqqxu-hEcI/AAAAAAAADFs/pvys679OzR4/s1600/castle.png" height="225" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-oPJFmj3B134/VS13LWo4nOI/AAAAAAAADGs/NiL9PXc6cLY/s1600/68.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-oPJFmj3B134/VS13LWo4nOI/AAAAAAAADGs/NiL9PXc6cLY/s1600/68.png" height="225" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-fNQtaQJ73c8/VSqrP7U1mfI/AAAAAAAADF0/ymsYQM4PnOs/s1600/castle_in.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-fNQtaQJ73c8/VSqrP7U1mfI/AAAAAAAADF0/ymsYQM4PnOs/s1600/castle_in.png" height="225" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-IDgOCQX-Bxs/VSqr0frw4vI/AAAAAAAADF8/a2I5AcvD6aw/s1600/ssao.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-IDgOCQX-Bxs/VSqr0frw4vI/AAAAAAAADF8/a2I5AcvD6aw/s1600/ssao.png" height="225" width="400" /></a></div>
<br />Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-29530436863142610282014-05-22T09:26:00.002-07:002014-05-23T00:50:22.147-07:00Voxel Engine Update - 18 Level Octree & Copy Paste in ActionCopy and Paste works well now. Areas of voxels can be grouped to new entities for placing them in the scene. The size of the entire voxel data of the screenshot below on disk is just 1.3MB, which is quite OK. Thanks to my new graphics card, voxel raycasting and terrain rendering also runs smoothly at 60+ fps at full HD resolution now. Also worth a note: The raycasting method is updated to allow octrees greater than 16 levels - the scene below is created in an 18 level octree. Now, problems with precision begin to arise, which need to be solved.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-KasCU6YjM8Y/U379qmrH_7I/AAAAAAAAC50/ZY9t699MYnI/s1600/46.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-KasCU6YjM8Y/U379qmrH_7I/AAAAAAAAC50/ZY9t699MYnI/s1600/46.png" height="360" width="640" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-a0iocYHk_Dc/U34jeto6ulI/AAAAAAAAC5k/apjZnEKW4MQ/s1600/44.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-a0iocYHk_Dc/U34jeto6ulI/AAAAAAAAC5k/apjZnEKW4MQ/s1600/44.png" height="360" width="640" /></a></div>
<br />
<iframe allowfullscreen="" frameborder="0" height="360" src="//www.youtube.com/embed/IukFkQ030aY" width="640"></iframe>
Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com4tag:blogger.com,1999:blog-2324674317366173964.post-22057048090858633462014-05-13T07:00:00.001-07:002017-11-25T10:38:40.333-08:00Quadric Mesh Simplification with Source CodeIn the past days I have written a quadric based mesh simplification program. After searching the internet I couldnt find any code that was free to use, not unnecessarily bloated, fast and memory efficient, even the <a href="http://dl.acm.org/citation.cfm?id=258849" target="_blank">quadric based method is soon 20 years old</a>. I therefore decided to write one myself.<br />
<br />
Features / Summary:<br />
<ul>
<li>Threshold based, therefore faster than sorting based methods</li>
<li>Since the Quadric Matrices are symmetric, only 10 elements are stored & computed per Matrix instead of 16</li>
<li>Non-closed meshes are supported by extra treating mesh borders</li>
<li>Simplifies 2.000.000 triangles to 20.000 triangles in 3 seconds on a Core i7</li>
<li>MIT License</li>
<li>MS Visual Studio 2012 , C++</li>
</ul>
<div>
<i>Update Sept.20th 2014 : improved quality of reduced borders</i></div>
<div>
<br /></div>
The result is short and easy to use in case you need to adopt it to your project. You can fetch the C++ Project with source here: (about 300 lines for the main part, contained in <i>Simplify.h </i>)<br />
<br />
<b><span style="font-size: large;"><a href="https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification" target="_blank">Download Source and Data</a></span></b><br />
<br />
The code is about 4x-7x faster than Meshlab, which is already fast. Using multi-core programming, it could even be faster.<br />
<br />
Here a comparison along Meshlab, QSlim and this method:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-WCUu57LB5Xs/U3cVaJX43fI/AAAAAAAAC40/98ZwMgndYmQ/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://1.bp.blogspot.com/-WCUu57LB5Xs/U3cVaJX43fI/AAAAAAAAC40/98ZwMgndYmQ/s320/1.png" width="300" /></a>
<a href="http://4.bp.blogspot.com/-Oq74X1LkFfo/U3cVaJeS7UI/AAAAAAAAC44/efWF_oKbZLk/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://4.bp.blogspot.com/-Oq74X1LkFfo/U3cVaJeS7UI/AAAAAAAAC44/efWF_oKbZLk/s320/2.png" width="300" /></a>
<a href="http://1.bp.blogspot.com/-iUbJkdJsD7c/U3cVaHZl8MI/AAAAAAAAC48/lk_YsIZvXzI/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://1.bp.blogspot.com/-iUbJkdJsD7c/U3cVaHZl8MI/AAAAAAAAC48/lk_YsIZvXzI/s1600/3.png" width="300" /></a></div>
<br />
Program output (left) and Meshlab (right). Note that Meshlab produces floating teeth and looses details around the eyes, nose and the mouth region. Reduction was 85k -> 3k Triangles.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-eoljSiqn4mE/VB_76F8bUVI/AAAAAAAADBk/Nnl2C6xjZDQ/s1600/phong.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="208" src="https://1.bp.blogspot.com/-eoljSiqn4mE/VB_76F8bUVI/AAAAAAAADBk/Nnl2C6xjZDQ/s1600/phong.png" width="400" /></a></div>
<br />
Original (left) this code (middle) and meshlab (right)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-5eIQPQebMK8/VCLcozZvPsI/AAAAAAAADB4/IFyerVI7KYo/s1600/Clipboard01.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="213" src="https://1.bp.blogspot.com/-5eIQPQebMK8/VCLcozZvPsI/AAAAAAAADB4/IFyerVI7KYo/s1600/Clipboard01.png" width="400" /></a></div>
<br />
Here another comparison: Program output (left) and Meshlab (right).<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-Vqb8ac6aHPc/U3I-tDop4LI/AAAAAAAAC4g/xxaBFOSq6so/s1600/Clipboard03.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="197" src="https://4.bp.blogspot.com/-Vqb8ac6aHPc/U3I-tDop4LI/AAAAAAAAC4g/xxaBFOSq6so/s1600/Clipboard03.png" width="400" /></a></div>
<br />Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com42tag:blogger.com,1999:blog-2324674317366173964.post-71591714992268408652014-05-03T09:26:00.001-07:002014-05-04T21:47:30.500-07:00Raycaster Speed-Up up to 400% by Image Warping (ReProjection)<b>Introduction:</b> Since real-time raytracing is getting faster like with the Brigade Raytracer e.g., I believe this technology can be an important contribution to this area, as it might bring raytracing one step closer to being usable for video games.<br />
<br />
<b>Algorithm:</b> A technology I am working on since a while now is to exploit temporal coherence between two consecutive rendered images to speed up ray-casting. The idea is to store the x- y- and z-coordinate for each pixel in the scene in a coordinate-buffer and re-project it into the following screen using the differential view matrix. The resulting image will look as Fig.1.<br />
<br />
The method then gathers empty 2x2 pixel blocks on the screen and stores them into an indexbuffer for raycasting the holes. Raycasting single pixels too inefficient. Small holes remaining after the hole-filling pass are closed by a simple image filter. To improve the overall quality, the method updates the screen in tiles (8x4) by raycasting an entire tile and overwriting the cache. Doing so, the entire cache is refreshed after 32 frames. Further, a triple buffer system is used. That means two image caches which are copied to alternately and one buffer that is written to. This is done since it often happens that a pixel is overwritten in one frame, but becomes visible already in the next frame. Therefore, before the hole filling starts, the two cache buffers are projected to the main image buffer.<br />
<br />
<b>Limitations:</b> The method also comes with limitations of course. So the speed up depends on the motion in the scene obviously, and the method is only suitable for primary rays and pixel properties that remain constant over multiple frames, such as static ambient lighting. Further, during fast motions, the silhouettes of geometry close to the camera tends to loose precision and geometry in the background will not move as smooth as if the scene is fully raytraced each time. There, future work might include creating suitable image filters to avoid these effects.<br />
<br />
<b>Results:</b> Most of the pixels can be re-used using this technology. As only a fraction of the original needs to be raycasted, the speed up is significant and up to 5x the original speed, depending on the scene (see Fig.2 - Fig.4). Resolution for that test was 1024x768, the GPU was an NVIDIA GeForce GTX765M.<br />
<br />
Here also two videos showing this technology in action: <a href="https://www.youtube.com/watch?v=U5yE-eaUjyk" target="_blank">Video1</a> <a href="https://www.youtube.com/watch?v=ij0vw8yTCsY" target="_blank">Video2 </a><br />
(I uploaded them a while ago)<br />
<br />
Finally a few papers for further reading:<br />
<a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.58.1859&rep=rep1&type=pdf" target="_blank">Exploiting Temporal Coherence in Ray Casted Walkthroughs</a><br />
<a href="http://graphics.ethz.ch/Downloads/Publications/Papers/2012/Bow12/Bow12.pdf" target="_blank">Iterative Image Warping</a><br />
<a href="http://www.uni-weimar.de/fileadmin/user/fak/medien/professuren/Virtual_Reality/documents/publications/2009_imwarp_cag.pdf" target="_blank">A Shared-Scene-Graph Image-Warping Architecture for VR: Low Latency versus Image Quality</a><br />
<a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.66.1830&rep=rep1&type=pdf" target="_blank">Three-Dimensional Image Warping on Programmable Graphics Hardware</a><br />
<a href="http://gfx.cs.princeton.edu/pubs/Nehab_2007_ARS/NehEtAl07.pdf" target="_blank">Accelerating Real-Time Shading with Reverse Reprojection Caching</a><br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-6Qlu2WTrQYA/U2UK2-_nDZI/AAAAAAAAC24/JFEOcbp5QR4/s1600/Clipboard01.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-6Qlu2WTrQYA/U2UK2-_nDZI/AAAAAAAAC24/JFEOcbp5QR4/s1600/Clipboard01.png" height="235" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Fig.1 Result after basic re-projection</td></tr>
</tbody></table>
<div style="text-align: left;">
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-0cOi1tAXWQE/U2URZo3b-FI/AAAAAAAAC3Y/XHretAV-vRs/s1600/Clipboard03.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-0cOi1tAXWQE/U2URZo3b-FI/AAAAAAAAC3Y/XHretAV-vRs/s1600/Clipboard03.png" height="310" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Fig.2 Original Version</td></tr>
</tbody></table>
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-J04wbhGkans/U2URZJbB1WI/AAAAAAAAC3Q/DKAZRJL_ljE/s1600/Clipboard04.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-J04wbhGkans/U2URZJbB1WI/AAAAAAAAC3Q/DKAZRJL_ljE/s1600/Clipboard04.png" height="310" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Fig.3 With Re-Projection Enabled + In Motion</td></tr>
</tbody></table>
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-S8cdyIaBtQw/U2URZE4vhQI/AAAAAAAAC3U/_76fbGKqt6Q/s1600/Clipboard05.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://3.bp.blogspot.com/-S8cdyIaBtQw/U2URZE4vhQI/AAAAAAAAC3U/_76fbGKqt6Q/s1600/Clipboard05.png" height="310" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Fig.4 With Re-Projection Enabled + Standing</td></tr>
</tbody></table>
<div>
<br /></div>Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com1tag:blogger.com,1999:blog-2324674317366173964.post-60144051237065128782014-04-30T10:51:00.001-07:002014-05-01T10:40:25.769-07:00Polygon Rendering vs. Voxel RaycastingSince I started the project I have always wondered if it wouldnt be better to use polygons/triangles rather than voxels. To verify this decision, I created a reasonably complex test scene from multiple instances of the same block, and rendered the scene once with triangles using Display Lists & LOD and second using voxel raycasting (LOD inherently). The triangle block is created by exporting the voxels as polygon mesh, and then using Meshlab to reduce the triangles and create multiple LOD levels.<br />
<br />
It turns out that triangles are much faster for a small to a medium number of instances (its about equal for 10x10x10 = 1000 instances) - but when having a large amount of 8000 instances (32 Million Triangles), 40x5x40 blocks, voxel raycasting is significantly faster ( 40 vs 13 fps ).<br />
<br />
For triangles, I havent used any sophisticated occlusion culling. It would therefore be interesting to see how much more performance could be achieved using the voxel based umbra or the <a href="https://software.intel.com/en-us/blogs/2013/09/06/software-occlusion-culling-update-2" target="_blank">software based rasterization </a>presented by intel.<br />
<br />
For the ones of you that would like to experiment with occlusion culling, the source & data of the polygon benchmark can be downloaded <a href="http://raycast.org/data/PolygonBenchmark.zip" target="_blank">[<b>here]</b></a>.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-lN7baLcktT4/U2E3IAsdsgI/AAAAAAAAC2Q/1UkYKsTR44g/s1600/41.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-lN7baLcktT4/U2E3IAsdsgI/AAAAAAAAC2Q/1UkYKsTR44g/s1600/41.png" height="100" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Raycasting Outside</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-_etKDe9f0P0/U2E3IIGtPoI/AAAAAAAAC2M/2OmVxjLG8XI/s1600/42.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-_etKDe9f0P0/U2E3IIGtPoI/AAAAAAAAC2M/2OmVxjLG8XI/s1600/42.png" height="100" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Raycasting inside</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-VDvt78ScVes/U2E3TzQH_JI/AAAAAAAAC2c/iB1j5je2qFk/s1600/1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-VDvt78ScVes/U2E3TzQH_JI/AAAAAAAAC2c/iB1j5je2qFk/s1600/1.png" height="106" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Triangles Outside</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-UMwXjqCz9_8/U2E3Txuof6I/AAAAAAAAC2g/AKeyEn3OuQI/s1600/2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-UMwXjqCz9_8/U2E3Txuof6I/AAAAAAAAC2g/AKeyEn3OuQI/s1600/2.png" height="106" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Triangles inside</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com3tag:blogger.com,1999:blog-2324674317366173964.post-91556856618455771772014-04-27T08:39:00.001-07:002014-04-27T08:39:15.397-07:00Minecraft StyleHere a test how a 100% block landscape would look - basically like Minecraft.<br />
<br />
<a href="http://3.bp.blogspot.com/-POvLOeAbRew/U10kCsajeUI/AAAAAAAACzk/mQtIeikffGI/s1600/1.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em; text-align: center;"><img border="0" src="http://3.bp.blogspot.com/-POvLOeAbRew/U10kCsajeUI/AAAAAAAACzk/mQtIeikffGI/s1600/1.png" height="320" width="640" /></a>Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-9169348229140425932014-04-26T16:03:00.006-07:002014-04-27T00:23:27.655-07:00NVIDIA GTX580M vs ATI Radeon R9 270x @1920x1024Today I tried to run the demo on a newer ATI 270x card of a friend. The result was better than expected as the ATI card achieved greater 100 fps for most of the time. On the GTX580M, the framerate was around 40 outside and ~30 indoors.<br />
<br />
New features in this version: FXAA & loading / saving of level data.<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-d_OR1-Roi30/U1w6yydmvkI/AAAAAAAACzM/cCqiBZAIUas/s1600/ati270x.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://1.bp.blogspot.com/-d_OR1-Roi30/U1w6yydmvkI/AAAAAAAACzM/cCqiBZAIUas/s1600/ati270x.png" height="111" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">ATI Radeon R9 270x</td></tr>
</tbody></table>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-5Hv3bxAIAi8/U1w6y7lPv3I/AAAAAAAACzI/I1_KmrSL4FM/s1600/gtx580m.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://4.bp.blogspot.com/-5Hv3bxAIAi8/U1w6y7lPv3I/AAAAAAAACzI/I1_KmrSL4FM/s1600/gtx580m.png" height="110" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">NVIDIA GTX 580M</td></tr>
</tbody></table>
Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-89255197053372688562014-04-22T10:47:00.001-07:002014-04-27T20:44:19.774-07:00Collision DetectionThe next important feature is mostly working now : Collision Detection. I played a bit around to create a castle in the sky.
<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="360" src="//www.youtube.com/embed/-REhBWXpv1g" width="640"></iframe>Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-58994582934390817192014-04-12T11:37:00.002-07:002014-04-12T12:20:27.098-07:00New Sandbox FeaturesThe editor now has a shelf and add/delete function for block setting as well as a box to indicate where to set a block. Further (2nd video), the new version features sound driven light effects that can be chosen when voxel sculpting.<br />
<br />
<br />
<iframe width="640" height="360" src="//www.youtube.com/embed/3ML_Art8xbQ" frameborder="0" allowfullscreen></iframe>
<iframe width="640" height="360" src="//www.youtube.com/embed/E6wyeVmjxk0" frameborder="0" allowfullscreen></iframe>Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-46256005360040513952014-04-06T11:12:00.003-07:002014-04-07T01:46:28.821-07:00Turrican Style Retro LookToday some new experiments to get a retro look.Shading and background is changed accordingly.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-zzaz5dMv8Yo/U0Gu2u328WI/AAAAAAAACys/CCKNud73VDg/s1600/Clipboard04.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-zzaz5dMv8Yo/U0Gu2u328WI/AAAAAAAACys/CCKNud73VDg/s1600/Clipboard04.png" height="332" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-nLViLJ9EEEk/U0GYokxPqvI/AAAAAAAACyU/FVfI9D8ikng/s1600/Clipboard01.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><a href="http://3.bp.blogspot.com/-nLViLJ9EEEk/U0GYokxPqvI/AAAAAAAACyU/FVfI9D8ikng/s1600/Clipboard01.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-nLViLJ9EEEk/U0GYokxPqvI/AAAAAAAACyU/FVfI9D8ikng/s320/Clipboard01.png" height="111" width="200" /></a><a href="http://1.bp.blogspot.com/-_XirSLGz0KU/U0GYqCFyQII/AAAAAAAACyc/ZE6USVt6JZ8/s1600/Clipboard02.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-_XirSLGz0KU/U0GYqCFyQII/AAAAAAAACyc/ZE6USVt6JZ8/s320/Clipboard02.png" height="112" width="200" /></a></div>
Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-31086763142299240372014-04-02T10:21:00.001-07:002014-04-02T10:27:56.443-07:00Minecraft-Style Sandbox Editing and Voxel Cube CraftingToday I am posting a video that shows how the entire process from creation a voxel cube to using the voxel cube(s) for sandbox style world editing. It is captured in real-time, so feel free to zap if you feel bored at any point.<br />
<br />
<br />
<iframe width="640" height="360" src="//www.youtube.com/embed/tUyz-22KyXw" frameborder="0" allowfullscreen></iframe>Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-48182046819626184462014-04-01T10:08:00.000-07:002014-04-01T10:08:44.815-07:00Merging with correct ZBuffer and LightMerging triangle data with voxels now works also for the depth buffer. Shading is also unified.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-7u6ytX6FcMw/UzrvAFftMII/AAAAAAAACx4/RyAXNJ-dc-Q/s1600/5.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-7u6ytX6FcMw/UzrvAFftMII/AAAAAAAACx4/RyAXNJ-dc-Q/s1600/5.png" height="352" width="640" /></a></div>
<br />Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-67566484664240418302014-03-11T11:59:00.001-07:002014-03-11T12:01:46.339-07:00Combined Voxel - Polygon RenderingToday I am proud to present the first screenshot of combined voxel raycasting / triangle based terrain rendering of a simple scene. Better results will hopefully follow in the next posts.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-qr-iaVBwxbU/Ux9cihxb--I/AAAAAAAACwo/wm_3OnjQlX8/s1600/Clipboard01.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-qr-iaVBwxbU/Ux9cihxb--I/AAAAAAAACwo/wm_3OnjQlX8/s640/Clipboard01.png" /></a></div>
Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com0tag:blogger.com,1999:blog-2324674317366173964.post-13982232630076721752014-03-02T09:03:00.001-08:002019-10-23T06:08:10.748-07:00Skinned Skeletal Animation Tutorial with Source Code<span style="font-family: "arial" , "helvetica" , sans-serif;">Today I completed a skinned skeletal animation tutorial, which is very helpful if you are just about to start with game development.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Different from the other tutorials I found in the web, this one is very light weight ( < 800 lines for the main mesh & animation code ) and works well with most modeling environments.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><a href="https://github.com/sp4cerat/Game-GUI">DOWNLOAD SOURCE + DATA</a><span id="goog_1702432366"></span><a href="https://www.blogger.com/"></a><span id="goog_1702432367"></span></span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<b><span style="font-family: "arial" , "helvetica" , sans-serif;">Summary</span></b><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">It has the following properties / features:</span><br />
<ul>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">GPU Skinning / Matrix Palette Skinning</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Bump Mapping (automatic normal map generation)</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Spheric environment mapping</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Ogre XML Based</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Shaders in GLSL</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Visual Studio 2010</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Select LOD level with F1..F5</span></li>
</ul>
It is ready to use, which means you can load and display the animated models in a few lines of code:
<br />
<pre class="brush: csharp">static Mesh halo("halo.material",// required material file)
"halo.mesh.xml", // required mesh file
"halo.skeleton.xml"); // optional skeleton file
int idle = halo.animation.GetAnimationIndexOf("idle");
halo.animation.SetPose(idle, // animation id (2 animations are available)
time_elapsed); // time in seconds
halo.Draw( vec3f(0,0,0), // position
vec3f(0,0,0), // rotation
0); // LOD level
</pre>
<br />
Also getting a bone matrix to put a weapon in the hand of the player e.g. is very simple:<br />
<pre class="brush: csharp">int index = halo.animation.GetBoneIndexOf("joint1");
matrix44 m = halo.animation.bones[ index ].matrix;
</pre>
<br />
Setting the arm joint individually for shooting a weapon e.g. works as follows:( press F6 in the demo )<br />
<pre class="brush: csharp">// get the index
int index = halo.animation.GetBoneIndexOf("joint2");
// get / modify / set the matrix
matrix44 m = halo.animation.bones[ index ].matrix;
m.x_component()=vec3f(1,0,0);
m.y_component()=vec3f(0,1,0); // set the rotation to identity
m.z_component()=vec3f(0,0,1);
halo.animation.bones[ index ].matrix=m;
// re-evaluate the child bones
loopi(0,halo.animation.bones[ index ].childs.size())
{
halo.animation.EvalSubtree(
halo.animation.bones[ index ].childs[i], // bone id
halo.animation.animations[0], // animation
-1); // key frame -1 means not use the animation
}
</pre>
<br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b>The workflow is as follows:</b></span><br />
<ul>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Design the Model in Maya/MAX/Blender/etc.</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Export the model using the <a href="http://www.ogre3d.org/tikiwiki/OGRE+Exporters" target="_blank">OgreExporter</a></span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Convert the model from Ogre binary to Ogre XML (batch file is included)</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Load the model in the tutorial code</span></li>
</ul>
<div>
<b><span style="font-family: "arial" , "helvetica" , sans-serif;">The Main Skinning in GLSL: </span></b></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">The main skinning is done in the vertex shader and only requires a few lines.
For the shader, the skinning weights are stored in the color information as 3 floats.
The bone IDs are unpacked from the w coordinate of the position information.
The bone matrixes are stored as simple matrix array..</span><br />
<pre class="brush: csharp">uniform mat4 bones[100];
uniform int use_skinning;
void main(void)
{
mat4 mfinal = gl_ModelViewMatrix ;
// skinning
if(use_skinning==1)
{
vec3 weights= gl_Color.xyz;
vec3 boneid = gl_Vertex.w * vec3( 1.0/128.0 , 1.0 , 128.0 );
boneid = (boneid - floor(boneid))*128.0;
mat4 mskin = bones[int(boneid.x)]*weights.x+
bones[int(boneid.y)]*weights.y+
bones[int(boneid.z)]*weights.z;
mfinal = mfinal * mskin;
}
gl_Position = gl_ProjectionMatrix * mfinal * vec4(gl_Vertex.xyz,1.0);
}
</pre>
<div>
<b><span style="font-family: "arial" , "helvetica" , sans-serif;">Note: </span></b></div>
<div>
<u><span style="font-family: "arial" , "helvetica" , sans-serif;">Animating Notes for Maya</span></u></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">For Maya, put all animations in one time-line and export them as separate animations.</span></div>
<div>
<u><span style="font-family: "arial" , "helvetica" , sans-serif;">Ogre Export</span></u></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Tangents need to be exported as 4D, to include the handedness. The tutorial version does not generate the tangents in the shader as it is faster to read them from the memory.</span></div>
<div>
<u><span style="font-family: "arial" , "helvetica" , sans-serif;">Bump Mapping</span></u></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">For the Ogre Material file, the bump map needs to be added manually by hand using the texture_bump parameter as follows:</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>texture Texture\masterchief_base.tif</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>texture_bump Texture\masterchief_bump_DISPLACEMENT.bmp</span></div>
<div>
<u><span style="font-family: "arial" , "helvetica" , sans-serif;">Ambient Texture Map</span></u></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Same here. For the Ogre Material file, the ambient map needs to be added manually by hand using the texture_ambient parameter.</span></div>
<div>
<u><span style="font-family: "arial" , "helvetica" , sans-serif;">Environment Mapping</span></u></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Environment mapping can be switched on in the material file using the following parameter:</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="background-color: white; line-height: 14.039999961853027px; white-space: pre;">env_map spherical</span></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="background-color: white; line-height: 14.039999961853027px; white-space: pre;">
</span></span>
<br />
<br />
<b>Screenshot of the settings in the OGRE exporter for Maya:</b><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-fvdwudttbWs/UzR7Agxp0kI/AAAAAAAACxk/WMuy4pLbgFQ/s1600/Clipboard01.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://1.bp.blogspot.com/-fvdwudttbWs/UzR7Agxp0kI/AAAAAAAACxk/WMuy4pLbgFQ/s200/Clipboard01.png" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<b><span style="font-family: "arial" , "helvetica" , sans-serif;">Commands to convert the OGRE binary to XML with 5 LODs</span></b><br />
<br />
..\ogre_xml_converter\OgreXMLConverter.exe halo.mesh tmp\tmp.xml<br />
..\ogre_xml_converter\OgreXMLConverter.exe -l 5 tmp\tmp.xml tmp\tmp.mesh<br />
..\ogre_xml_converter\OgreXMLConverter.exe tmp\tmp.mesh halo.mesh.xml<br />
..\ogre_xml_converter\OgreXMLConverter.exe halo.skeleton halo.skeleton.xml<br />
<br />
<div>
<b><span style="font-family: "arial" , "helvetica" , sans-serif;">Summary of the Code Structure: </span></b><br />
<br />
<u><span style="font-family: "arial" , "helvetica" , sans-serif;"></span></u><u><span style="font-family: "arial" , "helvetica" , sans-serif;">Main.h : </span></u>
<br />
<ul>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Main code </span></li>
</ul>
<u><span style="font-family: "arial" , "helvetica" , sans-serif;">Mesh.h : </span></u>
<br />
<ul>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Reads .mesh.xml & .material files</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Animation is optional</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">If an animation is present, it is stored in the animation variable </span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Per vertex, the following parameters are stored: position xyz, normal, texture UV, tangent, tangent handedness, 3x skin weight and 3x bone index.</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Bones are stored in the vertex shader as matrix palette (100 bones max)</span></li>
</ul>
</div>
<div>
<u><span style="font-family: "arial" , "helvetica" , sans-serif;">MeshAnimation.h : </span></u>
<br />
<ul>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Reads .skeleton.xml </span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Bones are stored in the bones array</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Animations are stored as tracks of keyframes for each animated bone </span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">After reading the animation, it is resampled to 20 frames per second</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">To set an animation, the skeleton matrices are computed by traversing the structure</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Afterwards, they are multiplied with the inverse skinning matrix before passing to the shader (could be precalculated)</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif;">Interpolation is linear so far - slerp could be added for better transitions.</span></li>
</ul>
</div>
</div>
<div>
<b><span style="font-family: "arial" , "helvetica" , sans-serif;">Download</span></b>
<b><span style="font-family: "arial" , "helvetica" , sans-serif;">
</span></b></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: medium;">Get the ZIP here [ <a href="http://raycast.org/data/Skeletal_Animation_Tutorial.zip" target="_blank">Download Source & Binary Files</a> ] . </span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">The skinned character is included as rigged Maya binary file & obj file.</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">You can find more free characters for <a href="http://tf3dm.com/" target="_blank">example here</a>.</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">
</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-w-VCWECoYEI/UxNaxOop-BI/AAAAAAAACwI/yX9Jud-DQ2A/s1600/Clipboard04.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><span style="font-family: "arial" , "helvetica" , sans-serif;"><img border="0" height="396" src="https://2.bp.blogspot.com/-w-VCWECoYEI/UxNaxOop-BI/AAAAAAAACwI/yX9Jud-DQ2A/s1600/Clipboard04.png" width="640" /></span></a></div>
Spacerathttp://www.blogger.com/profile/01007372171107150216noreply@blogger.com31