![]() |
||||||
|
|
||||||
|
Point Sprites
This tutorial demonstrates rendering pointsprites. Pointsprites are simple are simple billboards with only one vertex at the center. Let's start with the script code: shader = gl.Shader(Vertexshader,Fragmentshader); This code use some new functions and enums. First we have to enable the gl.VERTEX_PROGRAM_POINT_SIZE (may be removed in future lumina version). The output value in the vertex shader use "pixels" for calculating the size. To get always the same picture with different resolutions, we need to pass the viewportheight to the shader. The resizeEvent() handler correct thatr value if the Cam would be resized. The render() function contains some new Enable disable functions. They enable blending without depth test. gl.Enable(gl.POINT_SPRITE); enables rendering point sprites instead Points. (should I add Sphere.Draw(gl.POINTS_SPRITE); for cleaning the API?) Sphere is an simple stream of vertexpositions that can be created with the new "Test Particles" script located in the nodes contextmenus. A texture with a pointsprite texture is also needed, create one .... This Vertexshader calculates the depth corrected point size: uniform float Pointsize; An this simple Fragmentshader map the texture on the point sprite: uniform sampler2D Colormap;
|
||||||
|
|
|
|
|
|
|
|