<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>DuartePeixinho.com</title>

    <link>http://www.duartepeixinho.com</link>
    <description>DuartePeixinho.com</description><item>
       <title>Racing Game</title>
       <link>http://www.duartepeixinho.com/post/15/</link>
       <description>I had some 3D models lying around for a long time...<br /><br />I've been working on my engine for quite a while now (its an hobby, so I work on it when I want/have free time), and usually I make some examples that work as tests and as references for future me.<br />
<br />
A long time ago one good friend of mine made me a track and a car while was learning 3d modelling, and I never used them properly, they were used on a very incomplete example, but some days ago I tried to improve it and finally make at least a working demo with it.<br />
<br />
So thats what I did, a working demo where you can race an awesome car in a nice track. If you're fast enough you can save your fastest lap and race time, but you have to make it to the top 10.<br />
<br />
If you want to try, grab it <a href='https://www.dropbox.com/s/pbiip0on8v7sw7k/Racing%20Game.zip?dl=0' target='_blank'>here</a></description>
    </item><item>
       <title>Pyros3D on github</title>
       <link>http://www.duartepeixinho.com/post/14/</link>
       <description>I've open sourced my game engine.<br /><br />Well, after some time being on private repos, and decided that I should just open doors and allow others to see/use it/improve it. It isn't the best thing around nor the worst, but there are some games built with it, and you can check the demos in the repository. Its quite flexible and I think that it is really easy to expand and improve.<br />
<br />
Documentation is not available and I don't know if there will be, it depends if anyone is interested in it.<br />
<br />
You can check it in <a href='https://github.com/Peixinho/Pyros3D'>GitHub.com</a></description>
    </item><item>
       <title>Emscripten Revisited</title>
       <link>http://www.duartepeixinho.com/post/13/</link>
       <description>Well, since my last post some things have improved, and thankfully to emscripten, I can deploy almost every feature to the browser aswell.<br /><br />But this time, I wanted to go further, why not having my engine completely accessible through JavaScript?<br />
<br />
After Reading through emscripten docs, I decided to use <a href="http://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/WebIDL-Binder.html" target="_blank">WEBIDL Binder</a> like they did on their ports of Bullet aka <a href="https://github.com/kripken/ammo.js" target="_blank">Ammo.js</a> and <a href="https://github.com/kripken/box2d.js" target="_blank">Box2D.js</a>.<br />
<br />
Again, the JS file is giant (15.6MB) but some optimizations can be done and the JS file can also be minified. Anyway, besides my code, there's BulletPhysics and Freetype too on the JS, so that size is quite acceptable :)<br />
<br />
<a href="/pyrosjs" target="_blank">Here is a little demo, done entirely in JavaScript.</a><br />
<br />
PS: yes, the engine has a codename, pyros3d.<br />
PPS: maybe a new header should be coming? eheh</description>
    </item><item>
       <title>WebGL Hello World</title>
       <link>http://www.duartepeixinho.com/post/12/</link>
       <description>Here is my first attempt on WebGL<br /><br />Since I've heard about WebGL that I've wanted to try to do something with it, but my main focus has been C++ and OpenGL. I'm working on my little game engine for some time now, and I haven't had the try webgl and js.<br />
<br />
Then I've seen that <a href="https://github.com/kripken/emscripten" target="blank">esmcripten</a> is here for people like me, that likes to develop in c++ and then it compiles the c++ code, do its magic and output JS.<br />
<br />
So here is my first atempt on using <a href="https://github.com/kripken/emscripten" target="blank">esmcripten</a> with part of my engine to build a simple rotating cube.<br />
<br />
<div align="center"><a href="http://duartepeixinho.com/files/RotatingCube.html" target="_blank"><img src="/files/RotatingCube.png" /></a></div><br />
<br />
I know that its a really simple example, but its more a proof of concept that my engine with some minor tweaks can be "compiled" for the web.<br />
<br />
If somebody requests, I can post what those changes and tweaks that were necessary for this to work.<br />
<br />
(Bear in mind that it was compiled for debugging, so no optimization was done when compiling, and yea, the js for the rotating cube is 14MB(!) but that's mainly because most of the features of the engine are still there, despite that aren't used)</description>
    </item><item>
       <title>Benfica Sempre</title>
       <link>http://www.duartepeixinho.com/post/10/</link>
       <description>Benfica Sempre<br /><br /><div align="center"><img src="http://3.bp.blogspot.com/-X1BsVLVMKLE/UWv__zlcSnI/AAAAAAAAFkk/5bx_1BFCeuo/s1600/slb.jpg" /></div></description>
    </item><item>
       <title>Model Viewer</title>
       <link>http://www.duartepeixinho.com/post/9/</link>
       <description>I've been on holidays, so why not do something useful?<br /><br />This time I have something to show and share (if you want). I've created a simple model viewer using QT for the UI, and my Engine for the rendering part (OpenGL).<br />
<br />
I choose QT mainly because its cross platform, and after some days of usage, I can say that its much better than I thought.<br />
<br />
In the bottom of this post is the link to the win binaries, I only have Window$ binaries because the main purpose of this "project" was to run on top of Windows, but I think that a Linux version may appear in a couple of days (mac probably to :P, it depends how lazy I am to download the QT sdk for those platforms).<br />
<br />
<div style='text-align:center;'><img src='/images/viewer.png' alt='Model Viewer' title='ModelViewer' /><br />
</div><br />
<br />
Like I said, it is quite simple, but I will list the features:<br />
<br />
 - Load Models and their Materials(obj, 3ds, dae)<br />
 - Loads Model's Textures if are in use<br />
 - Change Model Properties<br />
   - Position<br />
   - Rotation<br />
   - Scale<br />
 - Add Directional Lights (its limited to 4)<br />
 - Rotate and Pan like it is expected to work in a Model Viewer<br />
 - Free 3D Camera<br />
<br />
This last one I think it is a feature not common in a Model Viewer and very handy, it gives you a FPS camera like, but free to go whatever you want to.<br />
<br />
<a href="/files/ModelViewer.zip">Click to Download</a><br />
<br />
Planned future features:<br />
 - Animation Support<br />
 - Change Properties using mouse gestures<br />
 - ...<br />
<br />
ps. Check the model's file path, they have to be correct. Also the textures (if its in use) path have to be relative to the model's file too.</description>
    </item><item>
       <title>GPU Skinning</title>
       <link>http://www.duartepeixinho.com/post/8/</link>
       <description>Since the last time I wrote here, I just loaded a model wishing merry christmas to everyone. But now I have something more ...<br /><br />I've been working a lot on my game engine, but I wanna have much more so I can post here, I dislike showing some unfinished features or small experiments, but the engine supports a lot of things, and much more is under work. It is a hobby project, so I can't work on it as much as I would like.<br />
<br />
As I showed on that <a href='http://duartepeixinho.com/post/7/' target='_blank'>post</a>, I've already loaded models before, but the one in that <a href='http://duartepeixinho.com/post/7/' target='_blank'>post</a> was a little "hacky", and lately I've been working on improving that and adding some sugar in it, <a href='http://en.wikipedia.org/wiki/Skeletal_animation' target='_blank'>skinning</a>.<br />
<br />
I have a video showing an example, this is still work in progress, but I think that having an animated model with a Lamp that has real light is cool.<br />
<div align='center' id='youtubeVideo'><object width="420" height="236.25"><br />
  <param name="movie" value="https://www.youtube.com/v/f1479NWfDXU?version=3"></param><br />
  <param name="allowFullScreen" value="true"></param><br />
  <param name="allowScriptAccess" value="always"></param><br />
  <embed src="https://www.youtube.com/v/f1479NWfDXU?version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="420" height="236.25"></embed><br />
</object></div><br />
<br />
I used the Assimp Library to load the geometry and animation, this lib is pretty nice because it supports a lot of different model formats that would be a pain in the ass to support.<br />
<br />
PS - Maybe the specular value isn't looking nice on the clothes, but I was lazy to change it :P</description>
    </item><item>
       <title>Merry Christmas to you all</title>
       <link>http://www.duartepeixinho.com/post/7/</link>
       <description>And a Happy New Year!!!<br /><br /><div style='text-align:center;'><img src='/images/Merry%20Christmas.png' alt='MerryChristmas' title='MerryChristmas' /><br />
<br />
(and here it is, a model loaded into my engine, it had to be a geeky Christmas wish, right? ;) )</div></description>
    </item><item>
       <title>Environment Reflection Help</title>
       <link>http://www.duartepeixinho.com/post/6/</link>
       <description>While I was developing some materials for my little C++/OpenGL engine, I tried to create an environment reflection map (also known as cubemap reflection). It's one of my favorite effects and since I couldn't find any solution online, I'm going to share my own solution.<br /><br />I'm just going to focus to the vertex and fragment shaders, I suppose that you know how to send uniforms and attributes to the shaders.<br />
<br />
The secret about this shader is to calculate the camera direction to the vertex position, and that calculation have to be done on World Space. In the Vertex Shader you have to send the Camera Position in World Coordinates, and the Model Matrix (sometimes called Model To World Matrix) to be able to calculate the vertex position in World Coordinates. <br />
All the other uniforms are common to almost all shaders.<br />
<br />
<pre class='brush: cpp'><br />
// Vertex Shader<br />
<br />
attribute vec3 aPosition, aNormal;<br />
uniform vec3 CameraPos;<br />
uniform mat4 ModelViewProjectionMatrix, NormalMatrix, ModelMatrix;<br />
varying vec3 vReflection;<br />
void main() {<br />
      // normal and position calculation<br />
      vec3 normal = normalize(NormalMatrix * vec4(aNormal,0)).xyz;<br />
      gl_Position = ModelViewProjectionMatrix * vec4(aPosition,1);<br />
<br />
      // Here is the environment map calculation<br />
      //<br />
      // First you have to calculate the Vertex Position in WorldPosition<br />
      // So you just need to multiply the Position by the ModelMatrix<br />
      vec3 vertex = (ModelMatrix * vec4(aPosition,1)).xyz;<br />
      // Now you have to do the same to the Normal, so you multiply<br />
      // the normal by the ModelMatrix (don't use the Normal calculated <br />
      // before)<br />
      vec3 N = normalize((ModelMatrix * vec4(aNormal,0)).xyz);<br />
      // The Incident value is the different of vertex and camera position<br />
      // (both on world coordinates)<br />
      vec3 I = vertex - CameraPos;<br />
      // Finaly you just simply calculate the reflection using reflect<br />
      // and as it is a varying variable, it is sent to the Fragment Shader<br />
      vReflection = reflect(I,N);<br />
}<br />
</pre>For the Fragment Shader you just need to send the samplerCube (it is just a combination of 6 images, one for each side of the cube).<br />
<pre class='brush: cpp'><br />
// Fragment Shader<br />
<br />
uniform samplerCube CubeMap;<br />
varying vec3 vReflection;<br />
void main() {<br />
      // Get the pixel color from the samplerCube using the Reflection that<br />
      // was calculated on the Vertex Shader<br />
      vec4 cubeColor = textureCube( CubeMap, vReflection );<br />
      // Just send the Color to the gl_FragColor<br />
      gl_FragColor = cubeColor;<br />
}<br />
</pre><br />
<br />
Here is an example:<br />
<img src='/images/cubemap.png' alt='CubeMap' title='CubeMap' /><br />
<br />
Now, you can add other stuff, like reflection factor, lighting and much more.</description>
    </item><item>
       <title>Some old flash experiments</title>
       <link>http://www.duartepeixinho.com/post/5/</link>
       <description>I think it should be nice to post some of my old flash experiments that I left on <a href="http://wonderfl.net" target="_blank">Wonderfl.net</a>.<br /><br />As3 Tree:<br />
<script type="text/javascript" src="http://wonderfl.net/blogparts/j4h8/js"></script><p class="ttlBpWonderfl" style="width: 465px; margin: 0; text-align: right; font-size: 11px;"><a href="http://wonderfl.net/c/j4h8" title="AS3 Tree">AS3 Tree - wonderfl build flash online</a></p><br />
<br />
Pixel Perfect Particles with Basic Physics:<br />
<script type="text/javascript" src="http://wonderfl.net/blogparts/lCG5/js"></script><p class="ttlBpWonderfl" style="width: 465px; margin: 0; text-align: right; font-size: 11px;"><a href="http://wonderfl.net/c/lCG5" title="Pixel Perfect Particles with Basic Physics">Pixel Perfect Particles with Basic Physics - wonderfl build flash online</a></p><br />
<br />
And another version:<br />
<script type="text/javascript" src="http://wonderfl.net/blogparts/3yRr/js"></script><p class="ttlBpWonderfl" style="width: 465px; margin: 0; text-align: right; font-size: 11px;"><a href="http://wonderfl.net/c/3yRr" title="forked from: Pixel Perfect Particles with Basic Physics">forked from: Pixel Perfect Particles with Basic Physics - wonderfl build flash online</a></p><br />
<br />
Those experiments combined:<br />
<object type="application/x-shockwave-flash" data="/flash/explodingTree/pixel.swf" width="640" height="480"><param name="movie" value="/flash/explodingTree/pixel.swf" /> </object><br />
(click on the scene to create a new tree)</description>
    </item>  </channel>
</rss>