May 25th 2014

PermaLink Sunday 25:22 am, by naman22 >>>MSGFORM<<<, 10 words, VIEWED 21 TIMES   English (US)
Categories: GSoC 2014

This post title is "Shadows!"

Yet another GSoC, only this time its shadows.
Game on!

Permalink BEFORESend feedbackAFTER • Trackback (0)
PermaLink Sunday 25:00 am, by naman22 >>>MSGFORM<<<, 9 words, VIEWED 20 TIMES   English (US)
Categories: General GSoC 2012, GSoC 2013

This post title is "How water looks"

And that's how the CS water looks.
Youtube Link!

Permalink BEFORESend feedbackAFTER • Trackback (0)

September 26th 2013

PermaLink Thursday 26:12 am, by naman22 >>>MSGFORM<<<, 156 words, VIEWED 551 TIMES   English (US)
Categories: Weaver

This post title is "Shader Weaver"

Hello,

Shader weavers are intimidating at first mainly because it is difficult to debug them and connections are quite confusing.
The basic idea of weaver can be learned from here. However, the code written in it is outdated... better to go with code.

Following are some weaver debugging techniques that I learned.
1. Debugging by altering the output color. ex

if(something_happens) 
        bug=1.0;
 op_col.r+=bug;

2. CS flag to Disable shader cache : -cfgset=Video.ShaderManager.EnableShaderCache=false

3. CS flag to Dump shader program at %temp%\shader : -cfgfile=/config/shader-debug.cfg

4. Dump textures at %temp%\textures

   a. CS flag : -plugin=bugplug
   b. ctrl+d
   c. ctrl+shift+t

5. Switching between CG/GLSL

   a. simplest way is to delete the shader plugin that isn't needed.
   b. Disable GLSL only : 
      -cfgset=Video.OpenGL.UseExtension.GL_ARB_shader_objects=false
   c. remove/edit the GLSL/CG technique in main entry weaver. 

6. CS flag to check syntax error: -verbose

-Naman

Permalink BEFORESend feedbackAFTER • Trackback (0)
PermaLink Thursday 26:30 am, by naman22 >>>MSGFORM<<<, 35 words, VIEWED 231 TIMES   English (US)
Categories: GSoC 2013

This post title is "Concluding GSoC 2013"

Hi,
Entire water's shader code has been ported to weaver which will enable to add post effects easily. Plus heightmaps to generate natural water waves and larger ocean size.
Now it looks like this...

pertub
LargeWater

-Naman

Permalink BEFORESend feedbackAFTER • Trackback (0)

July 22nd 2013

PermaLink Monday 22:07 pm, by naman22 >>>MSGFORM<<<, 258 words, VIEWED 1527 TIMES   English (US)
Categories: GSoC 2013

This post title is "Update GSoC 2013"

Howdy folks!,

So I had prepared couple of thing that had to be done before actually starting with interactivity.

1). Porting XmlShaders to ShaderWeaver.
2). Mismatching of texturemaps.
3). Large Size of Oceans
4). FFT in oceans
5). miscellaneous

As for 1). I tried to port the code, but I'm kinda still struggling to get it right. Thanks to res, Rlydontknow and Sueastside I'm able to understand them quite well but still weird errors priest.

The Mismatching actually didn't existed in temporary weaver code. so I guess the complete weavers should fix this issue.

The values of CELL_WID, CELL_LEN and MAX_OCEAN_DISTANCE are increased to spread the ocean even wider. but they increased the pre-computation of LODs thus the "gran" (vertex per tile) had to altered accordingly. gran = pow(2.0,LOD_type)/64.0f;

FFT needed VS texture mapping, but weavers weren't complete at the moment. So I decided to give it a shot in old shaders. If you look at the FFT implementation then you'll find that FFT is essentially creats a complex "texture". FFT calculations are very heavy. Thus it would rather be easier to just take a heightmap and use for ocean waves. It actually gives pretty decent result.

Heightmap

Along the way I found that the ocean water move along the camera which shouldn't happen because in a game water usually stays at one particular position. It does that due to LOD calculations. So along with taking waves parameters from the world file, the plugin will also take position and radius to which the user wants it to extend.

-Naman

Permalink BEFORESend feedbackAFTER • Trackback (0)

June 7th 2013

PermaLink Friday 7:04 pm, by naman22 >>>MSGFORM<<<, 39 words, VIEWED 609 TIMES   English (US)
Categories: GSoC 2013

This post title is "GSoC 2013"

Hi,
This Summer is going to be really exciting. I'm gonna beat the heat by mutating the CS water system. Thanks to CS community for considering my proposal on water simulation. Watch out for Wet CS!
starting with shaders. ;)

Permalink BEFORESend feedbackAFTER • Trackback (0)

August 5th 2012

PermaLink Sunday 5:59 pm, by naman22 >>>MSGFORM<<<, 293 words, VIEWED 6809 TIMES   English (US)
Categories: GSoC 2012

This post title is "Ocean's Shoreline"

Hey all,
So finally I finished with Shoreline implementation. I know my work should be over by now but I'm happy with new things i'm learning each day. :D. Basically I took a foam texture (programmers art like) and blended it on ocean mesh where ever ocean touches terrain.
This is done by first getting all the points( These points are in world space) where ocean touches terrain and then scale them down to store it in an array. Till now all steps are pre-computed on CPU. That array is now passed to shader program. Now in a vertex program, nearest distance between vexter position and array of foam points is computed and then that distance is passed to fragment program. In fragment program foam Colour is clamped depending on the distance.

Important note:-
I got pretty much everything working with ease except for first step i.e. Getting the foam point.
To get foam points first I got terrain from engine into the water plugin. Then iterated over each terrain cell's height map. Now the thing took me so long was that The coordnate system usually start from bottom left corner so are iteration over cells. But when you are performing texture(heightmap) lookups the coordnates start from top left corner. It took me 7 days to understand this.

This is how it looks like:-

shoreline

Side notes:-
*Array size is limited to 1000 a better way would be to create a texture and store all those points in it and perform a texture lookup in shaders
*This shoreline only works for Terrains. In order for them to work for any mesh, a plan collider can be used to get foam points. Rest of the steps would remain the same.

-Naman Gupta

Permalink BEFORESend feedbackAFTER • Trackback (0)

June 30th 2012

PermaLink Saturday 30:09 pm, by naman22 >>>MSGFORM<<<, 197 words, VIEWED 3149 TIMES   English (US)
Categories: GSoC 2012

This post title is "Ocean Shaders"

Ocean looked nice with connected meshes but it lacked reflection and refraction. Although Ocean is actually a deep water system thus should have no refraction but I did it anyways. For this implementation i followed this Paper.

It involved 5 basic steps.
1. Create the reflection texture : provided by engine
2. Create the refraction texture : provided by engine
3. Distort the textures according to a dudv-map :- We don't need it as it's used to apply distortion. Normal map worked equally great.
4. Apply bump mapping : not needed since we are using vertex shaders to generate waves.
5. Combine with fresnel effects : no problem :)

and here's the result

Ocean reflect refract

and this

island ocean

Some notes
-ocean exhibits No caustics. Caustics are already implemented in CS but aren't in ocean
-This shader is *not* shaderwaver. It is regular vertex and fragment program.
-LOD pops out as you move along.
-ocean doesn't entirely covers the island. a possible solution for it could be to increase the cell width and leght and corresponding parameters. so that it covers more area.
-also waves direction appears to be changing between different LOD when viewed from top. implementing inverse FFT could remove it, I think.

-Naman Gupta

Permalink BEFORESend feedbackAFTER • Trackback (0)
PermaLink Saturday 30:35 am, by naman22 >>>MSGFORM<<<, 308 words, VIEWED 1961 TIMES   English (US)
Categories: GSoC 2012

This post title is "Modification in ocean LOD and mesh"

So Crystal Space had a Ocean system in which Ocean was made by combining little ocean cells(20x20). These ocean cells would have different Level of Details(LOD) Governed by distance from camera. This distribution of LOD wasn't quite working as distance computed between camera and the cell was actually a *squared* distance and comparison was made with actual distance. Also cells re-positions themselves as camera move parallel to ocean. This re-positioning was causing a jerk. Well, both these bugs are fixed now. :)

Now comes the major issue *aaahhhh*. LOD distribution was working fine but the problem was with adjoining ocean cells of different LOD. for example one cell has LOD 5 and adjoining cell had LOD 4. Now LOD5 has double the vertices at boundaries than LOD4. and since the vertices are moving in waves like patterns so the ocean cells looks unconnected and Thus looked Ugly.

Thanks to Nvidia's ocean demo(and of course my mentor res) I was successfully able to replicate their implementation to rectify this problem. Checkout the wireframe rendering of ocean.
Here's what's happening.

Unmarked Oceancells

confused?
Now have a look at this

MarkedOceancell

Yellow color represents an oceancell.
Blue color represents inner mesh.
Green color represents the division line of outer meshes for a single cell.
there are four outer meshes for each cell.

Red color represents how LOD levels are connected using low res boundaries in higher LOD cell.

The vertices for a cells are computed as usual. The real magic happens in computing the triangle(tris). tris for inner meshes are computed as usual. then 2^4=16 different cells are created for one LOD level and stored in an array.
2^4 where 2 is the resolution ie low/high and 4 are edges Top/right/bottom/left. That's how we got the number 16. Desired cell(out of 16) selection depends upon LOD level adjoining cell.

-Naman Gupta

Permalink BEFORESend feedbackAFTER • Trackback (0)

Naman22's blog

July 2014
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

Search

Categories

Linkblog

GSoC 2012

  • Modification in ocean LOD and mesh

    So Crystal Space had a Ocean system in which Ocean was made by combining little ocean cells(20x20). These ocean cells would have different Level of Details(LOD) Governed by distance from camera. This distribution of LOD wasn't quite working as distance computed between camera and the cell was actually a *squared* distance and comparison was made with actual distance. Also cells re-positions themselves as camera move parallel to ocean. This re-positioning was causing a jerk. Well, both these bugs are fixed now. :)

    Now comes the major issue *aaahhhh*. LOD distribution was working fine but the problem was with adjoining ocean cells of different LOD. for example one cell has LOD 5 and adjoining cell had LOD 4. Now LOD5 has double the vertices at boundaries than LOD4. and since the vertices are moving in waves like patterns so the ocean cells looks unconnected and Thus looked Ugly.

    Thanks to Nvidia's ocean demo(and of course my mentor res) I was successfully able to replicate their implementation to rectify this problem. Checkout the wireframe rendering of ocean.
    Here's what's happening.

    Unmarked Oceancells

    confused?
    Now have a look at this

    MarkedOceancell

    Yellow color represents an oceancell.
    Blue color represents inner mesh.
    Green color represents the division line of outer meshes for a single cell.
    there are four outer meshes for each cell.

    Red color represents how LOD levels are connected using low res boundaries in higher LOD cell.

    The vertices for a cells are computed as usual. The real magic happens in computing the triangle(tris). tris for inner meshes are computed as usual. then 2^4=16 different cells are created for one LOD level and stored in an array.
    2^4 where 2 is the resolution ie low/high and 4 are edges Top/right/bottom/left. That's how we got the number 16. Desired cell(out of 16) selection depends upon LOD level adjoining cell.

    -Naman Gupta

    Permalink
  • Ocean Shaders

    Ocean looked nice with connected meshes but it lacked reflection and refraction. Although Ocean is actually a deep water system thus should have no refraction but I did it anyways. For this implementation i followed this Paper.

    It involved 5 basic steps.
    1. Create the reflection texture : provided by engine
    2. Create the refraction texture : provided by engine
    3. Distort the textures according to a dudv-map :- We don't need it as it's used to apply distortion. Normal map worked equally great.
    4. Apply bump mapping : not needed since we are using vertex shaders to generate waves.
    5. Combine with fresnel effects : no problem :)

    and here's the result

    Ocean reflect refract

    and this

    island ocean

    Some notes
    -ocean exhibits No caustics. Caustics are already implemented in CS but aren't in ocean
    -This shader is *not* shaderwaver. It is regular vertex and fragment program.
    -LOD pops out as you move along.
    -ocean doesn't entirely covers the island. a possible solution for it could be to increase the cell width and leght and corresponding parameters. so that it covers more area.
    -also waves direction appears to be changing between different LOD when viewed from top. implementing inverse FFT could remove it, I think.

    -Naman Gupta

    Permalink
  • Ocean's Shoreline

    Hey all,
    So finally I finished with Shoreline implementation. I know my work should be over by now but I'm happy with new things i'm learning each day. :D. Basically I took a foam texture (programmers art like) and blended it on ocean mesh where ever ocean touches terrain.
    This is done by first getting all the points( These points are in world space) where ocean touches terrain and then scale them down to store it in an array. Till now all steps are pre-computed on CPU. That array is now passed to shader program. Now in a vertex program, nearest distance between vexter position and array of foam points is computed and then that distance is passed to fragment program. In fragment program foam Colour is clamped depending on the distance.

    Important note:-
    I got pretty much everything working with ease except for first step i.e. Getting the foam point.
    To get foam points first I got terrain from engine into the water plugin. Then iterated over each terrain cell's height map. Now the thing took me so long was that The coordnate system usually start from bottom left corner so are iteration over cells. But when you are performing texture(heightmap) lookups the coordnates start from top left corner. It took me 7 days to understand this.

    This is how it looks like:-

    shoreline

    Side notes:-
    *Array size is limited to 1000 a better way would be to create a texture and store all those points in it and perform a texture lookup in shaders
    *This shoreline only works for Terrains. In order for them to work for any mesh, a plan collider can be used to get foam points. Rest of the steps would remain the same.

    -Naman Gupta

    Permalink

GSoC 2013

  • Concluding GSoC 2013

    Hi,
    Entire water's shader code has been ported to weaver which will enable to add post effects easily. Plus heightmaps to generate natural water waves and larger ocean size.
    Now it looks like this...

    pertub
    LargeWater

    -Naman

    Permalink
  • GSoC 2013

    Hi,
    This Summer is going to be really exciting. I'm gonna beat the heat by mutating the CS water system. Thanks to CS community for considering my proposal on water simulation. Watch out for Wet CS!
    starting with shaders. ;)

    Permalink
  • Update GSoC 2013

    Howdy folks!,

    So I had prepared couple of thing that had to be done before actually starting with interactivity.

    1). Porting XmlShaders to ShaderWeaver.
    2). Mismatching of texturemaps.
    3). Large Size of Oceans
    4). FFT in oceans
    5). miscellaneous

    As for 1). I tried to port the code, but I'm kinda still struggling to get it right. Thanks to res, Rlydontknow and Sueastside I'm able to understand them quite well but still weird errors priest.

    The Mismatching actually didn't existed in temporary weaver code. so I guess the complete weavers should fix this issue.

    The values of CELL_WID, CELL_LEN and MAX_OCEAN_DISTANCE are increased to spread the ocean even wider. but they increased the pre-computation of LODs thus the "gran" (vertex per tile) had to altered accordingly. gran = pow(2.0,LOD_type)/64.0f;

    FFT needed VS texture mapping, but weavers weren't complete at the moment. So I decided to give it a shot in old shaders. If you look at the FFT implementation then you'll find that FFT is essentially creats a complex "texture". FFT calculations are very heavy. Thus it would rather be easier to just take a heightmap and use for ocean waves. It actually gives pretty decent result.

    Heightmap

    Along the way I found that the ocean water move along the camera which shouldn't happen because in a game water usually stays at one particular position. It does that due to LOD calculations. So along with taking waves parameters from the world file, the plugin will also take position and radius to which the user wants it to extend.

    -Naman

    Permalink

Weaver

  • Shader Weaver

    Hello,

    Shader weavers are intimidating at first mainly because it is difficult to debug them and connections are quite confusing.
    The basic idea of weaver can be learned from here. However, the code written in it is outdated... better to go with code.

    Following are some weaver debugging techniques that I learned.
    1. Debugging by altering the output color. ex

    if(something_happens) 
            bug=1.0;
     op_col.r+=bug;

    2. CS flag to Disable shader cache : -cfgset=Video.ShaderManager.EnableShaderCache=false

    3. CS flag to Dump shader program at %temp%\shader : -cfgfile=/config/shader-debug.cfg

    4. Dump textures at %temp%\textures

       a. CS flag : -plugin=bugplug
       b. ctrl+d
       c. ctrl+shift+t

    5. Switching between CG/GLSL

       a. simplest way is to delete the shader plugin that isn't needed.
       b. Disable GLSL only : 
          -cfgset=Video.OpenGL.UseExtension.GL_ARB_shader_objects=false
       c. remove/edit the GLSL/CG technique in main entry weaver. 

    6. CS flag to check syntax error: -verbose

    -Naman

    Permalink

GSoC 2014

  • Shadows!

    Yet another GSoC, only this time its shadows.
    Game on!

    Permalink

General

  • How water looks

    And that's how the CS water looks.
    Youtube Link!

    Permalink

XML Feeds

What is RSS?

Who's Online?

  • Guest Users: 229

powered by
b2evolution