본문 바로가기

Multimedia

http://hongweili.org/demo.html - Hongwei Li's Homepage

http://hongweili.org/demo.html - Hongwei Li's Homepage

 

 

 

Lead Engineer, Rightware Oy, Shanghai

To compile new my demo, my OpenGL framework is needed. The latest version is version 1.5 (2011-12-27)

  • Single-pass Wireframe Rendering

    permanent link | Sep. 14th, 2011 | Code

    When I did the selection on UAV, I found a wireframe shading could be a useful visualization. In the past, when I wanted this kind of rendering, I used a trick: rendering the shading triangles first, and then slightly shift the projection matrix to the negative z direction, and finally rendered the lines. The method is neat but leaves some artifacts near the silhouette where some lines sinks into the surface. Worse is it is a two-pass method.

    Read more...

  • OpenGL Selection using GL_ARB_shader_image_load_store

    permanent link | Sep. 14th, 2011 | Code (OpenGL 4.2 is required)

    Selection is supported in a compatible context of an OpenGL. But at fact, it is only done in a software approach. Hardware never provides such features, and driver makes it possible. Its basic idea is, rendering objects into the back buffer and using occlusion query to check if some pixels have fallen in the small picking frustum given by application (i.e., a hit). If so, driver retrieves the depth buffer and computes the minimum and maximum. The names (recall glLoadName, glPushName, etc) are kept in CPU and whenever something is hit, they are copied to user specified name buffer alongside minimum and maximum z values.

    There are some potential performance bottlenecks in this approach.

    Read more...

Old demos
  • Multiple lens flare effects.

    Lens flare happens because of the interesting optics properties of the glasses when they interact the incoming lights. I collected 10+ common lens flare effects here. Each of them is simply implemented by playing lines with and circles. They can be combined together to form more interesting and fancy effects. More details.





  • Anti-alias disk drawing.

    Suppose at some occasions, you have to write your own disk drawing function. Your boss says, you will know the size, color and center of the disk. Please give me the image which has that specified disk on a white canvas this afternoon. You might be little puzzled if you are used to call GUI drawing primitives in your past life. Well, just calm down, I am here to help you punch your boss back. Download the code.




  • God rays.

    God rays are rays omitting from bright objects, like sun. Here I provide a CPU implementation of God rays for any 2D image. When the center and the length of rays are specified, the algorithm takes linearly time to finish the output. There still are several acceleration tricks that can be done, like caching the bilinear sampling coordinates and using unsigned char instead of float image. Coming




  • The simplest Lloyd's relaxation.

    Lloyd's relaxation is the most elegant method for obtaining a blue noise sampling. It make any sampling converge to blue noise sampling by iteratively repeating Voronoi diagram construction and samples position refinement. I here introduce a very simple-to-implement Lloyd's relaxation without bothering the computational geometry.
    Coming




  • Spectral analysis of sampling.

    For those who are struggling with figuring out how to do spectral analysis on 2D and spherical domain. More details can be found in my anisotropic blue noise paper. Download (2D). Download (Spherical domain).






  • Integral line convolution.

    Line Integral Convolution is a very a old, successful and yet useful vector field visualization method. It helped a lot when I did my last project in which I need to verify my synthesized edge tangent field of the input image. Though its popularity, I found few people would like to share their code of LIC with the crowd. Trust me or google yourself. That is the initial motivation I release my code. Download.




  • Nehe OpenGL ES 2.0 port for iPhone.

    Download lessons from Google Code, here.








  • Ocean wave simulation.

    My undergraduate project. It uses FFT to generate the integral of a set of randomized sin waves. It simulates the ocean wave plausibly. Download







  • My OpengGL application framework

    Here is my homebrew framework for OpenGL application. It is an incremental project. Whenever I learned something new about OpenGL, I add it into the framework. All the new demos are relying on this framework. Download






  • Play the bit

    Here are some tricky bit magics. All of them come from some my job interviews.
    Use Xor, Count 1 bits, Multiple of 32,







  • Convert PPM to EPS

    EPS is a very handy tool when you only want to draw some 2D anti-aliasing objects. Here I refer you a very nice EPS programming tutorial "EPS: a Programming Language - by MJ Rutter". The only missing thing in that decent manual is to embed a background image to the EPS file. Here I introduce you my PPM2EPS program, which converts a PPM file to an EPS file with no quality loss. You may change the source code to fit your purpose without my permission. Download,



  • STL Heap plus

    STL Heap plus is an extension to std::heap. I wrote it when I was taking the course "computer vision" and working on the project one "intelligent scissor". At that time, I found unfortunately the std::heap does not provide the functionality of updating the value of node in a heap. That's the motivation I wrote my heapplus. I knew there might be something already done for this job, like in booster. Well, the problem is they are sometimes too large or too generic. I just wanted a small piece of code, suited for the task at hand. Download, Updates,