Test: Gpu Raymarch of Distance fields

April 20th, 2011
YouTube Preview Image


  • Ray marching of distance fields done on the Gpu inspired by IQ demo “Slisesix” and  Shadertoy. The video shows two scenes rendered with a pixel shader: the simple scene showing basic distance fields and the more elaborated one, showing procedural distance fields and shading.

Read the rest of this entry »

Siggraph 2010

July 23rd, 2010

As you may already know Siggraph 2010 is taking place this year at the LA Convention Center from 25th to 29th  July. I will be there, in fact I’m already, as a member of the Siggraph GraphicsNet team, which deploys and engineers the conference network. That means: running tons of cable through all the conference center!

Hopefully I will have some time to attend a talk or maybe a course. Anyway, if you want to catch me up during the conference just drop me an email.

Happy Siggraph everyone!

Test: Task based Flock Simulation

June 9th, 2010
YouTube Preview Image


  • Flock simulation using tasks in order to keep busy all the cpu cores. It uses the Vista Pool Thread API to make a really simple wrap for send multiple tasks to the pool. The video shows how most of cpu cores (hardware threads) are not working under a heavy load of work with only one task in the pool. If the work is spread across multiple tasks, the video shows how all the cpu cores are busy.


Read the rest of this entry »

Test: CUDA Volume Raycasting

March 3rd, 2010
YouTube Preview Image


  • CUDA based application showing gpu volume raycasting using single pass Stegmaier et al. technique.


Read the rest of this entry »

Test: GPU Volume Raycasting

February 9th, 2010
YouTube Preview Image


  • Opengl based application showing gpu volume raycasting using single pass Stegmaier et al. technique.


Read the rest of this entry »

New adventure in Cambridge

October 12th, 2009

Well, after some time without updating the blog I’m giving some life signals. Sorry for the lack of updates but I’ve been super busy moving to Cambridge. Yes, I moved to Cambridge to work for ArtVPS as a software developer. I’m working with real time ray tracing renderers, which is really cool. The people here are great professionals and I’m very pleased to have the opportunity to work with them.  As you could imagine I have no time to do anything aside searching a flat and getting used to listen English the whole day. I left my machine in Madrid, so no tech demos in a couple of months. I have to figure out how the hell I’m going to bring all that (2 monitors, a big case, 7.1 speakers,…..) to Cambridge.

Summer blog break

July 23rd, 2009

I’m going to take a break from updating the blog. I will post again in September. Have a happy summer!

ITC2009: Line Segment Intersection

July 4th, 2009

The problem of this contest’s round was to find the intersections within a set of 3d line segments. I found tons of information in google about algorithms solving this problem in 2d. It seems that finding the intersections in a set of 2d line segments is a well known problem of computational geometry. Unfortunately, I didn’t find any algorithm in 3d and I wasn’t sure that converting the 2d algorithms to 3d could give better results than a brute force approach. Taking this into account, I decided to implement a brute force algorithm using a simple line segment intersection test. This approach gave ~800secs in a set of 100.000 line segments. I realized that the tests that were already tested could be skipped, after the modification the algorithm gave ~300secs. At this moment, I removed every instruction of the if intersection test statement (don’t ask why) resulting in a running time of ~6secs. This time was wrong. I was compiling with the optimizations active, so the compiler just removed the call to the intersection test function, giving a double nested loop doing pointer dereferencing. Well, after this little mistake I was ready to think in how to parallelize the algorithm.

As with the previous problem I used Threading Building Blocks as the tool to parallelize the algorithm. I chose to use the parallel_reduce algorithm, after trying to make it with parallel_for. The problem is gathering the results across all the tasks. Parallel_reduce is an easy way of collect results after the tasks completion. The algorithm includes a synchronization method: join. After a task ends the join method is called to merge the results. The parallel approach gave me a time of ~60secs.

I think the speed I got wasn’t that fast to win this round but that’s not my objective. I’m having a lot of fun, I’m learning from other people and I’m learning how to use TBB. Those are my objectives.

ITC2009: Knapsack

June 20th, 2009

The 5th problem of the Intel Threading Challenge 2009 Contest is a bounded knapsack  problem with real numbers instead of integers. You can get more information about knapsack problems in “Knapsack Problems: Algorithms and Computer Implementations”, Silvano Martello and Paolo Tooth, which is a free book.  I implemented a classical dynamic programming algorithm using Intel Threading Build Blocks to parallelize it. More information on dynamic programming in “Introduction to Algorithms, Second Edition” .

The approach I took to solve the problem is really naive due time constraints. The problems I found were:

  • Convert a bounded knapsack problem to a 0-1 knapsack problem.
  • Convert real number weights and benefits to integers.
  • Parallelization of the serial algorithm.
  • Memory efficiency.

The serial algorithm is really naive:

  1. Convert the weights and values to integer numbers.
  2. Convert the problem to a 0-1 knapsack problem repeating bounded limit times the items.
  3. Solve 0-1 knapsack problems with a dynamic programming algorithm.
  4. Trace back the items.

As you see this approach is the classical example of dynamic programming you can find in textbooks. Although it has big problems when you try to solve big data.  Repeating the items bounded limit times its a really easy way to convert the problem but needs tons of memory. Multiplying by 100 makes the deal, but it can lead to rounding precision problems. The parallel algorithm is the same but using a “parallel_for” to replace the second for loop of the algorithm.

Well, the solution proposed is very naive, so I don’t expect good results in the contest. Anyway, I enjoyed the problem and I’m already thinking about the next one: “Segment intersection”.

Intel Threading Challenge 2009

June 8th, 2009

Intel Threading Challenge 2009 is an intel contest where you have to implement a multi-threaded solution for a given set of problems using any tech you want (not necessarily from intel) but taking into account the test machine specs. The problems are spawned every two weeks with 19 days to complete the task. There are two phases with six problems to solve. The score in a phase will be the sum of your three best scored submitted solutions. The solution should include a kind of report and of course the source code. You can find here an example of the report and more information about the rules, prizes, etc… here. The contest is managed, or at least it seems so, by Dr. Clay Breshears. As his bio shows, he is a really experienced engineer. Recently, he published a book on parallel programming “The Art of Concurrency: A Thread Monkey’s Guide to Writing Parallel Applications“, which I’m going to buy after I read “Intel Threading Building Blocks: Outfitting C++ for Multi-core Processor Parallelism“and “The Art of Multiprocessor Programming“. By the way, he made a hell of a fun video about concurrent programming: “A visual guide to key concepts in threaded programming – Common problems and how to solve them

I really don’t have much time but I could enjoy participating in this contest and well, it’s a nice excuse to get my hands on Threading Building Blocks. I’m going to give a try for the next couple of weeks to the first problem (bounded knapsack problem) and I will see if I have fun. Don’t expect any graphics related tests/tech demos in the meantime although I want to show something of the entry development. For the moment, I don’t know exactly what I’m going to show but I will.