We can see Glow effect in almost every game now. Indeed it really improves the visual result to the next level~ In this demo, I used some simply ways to implement the glow effect. Of course the first thing was to render the scene into a texture since its another post-processing rendering. So I rendered the scene with specular on and saved it to my texture and used it for my glow texture creation.
In order to produce that blurry effect, I first copied the scene texture to another small size one. This not only decreased the shader calculation but also created the basic blurry effect =P. After that I made the texture to multiply itself several time to make the bright color brighter and the dark color darker. And then I used Gaussian Blur to blur the result and Yea! a glow texture was done. Finally I added it with the original scene texture and its done~ ^_^
The result was like this~
Wednesday, April 26, 2006
Sunday, April 23, 2006
NPR Style[EX!]
What!? NPR again? Hehe...but this time is more challenging~ The main focus of this demo is color distortion effect. The rendering result is quiet attracting(to me =P ).
This is another post-processing demo so as usual we will output the scene color to a texture. But for new edge detection effect, we will need the scene normal and depth as well. So we output the normal as "rgb" and depth as "a" into another texture. And after that we will use these textures to do the post-processing part.
Step1~~Color Distortion:
Use this method to distort the color and make the output look like hand drawing. Steps are:
1. Downsample color texture into a smaller texture.
2. Convert from RGB to HSV color space and quantize color values. This color space conversion is done via a dependent lookup into a volume texture.
3. Sample the same image at 2 displaced positions; using 2 2D offset textures.
Sampling textures~
4. Compare the samples; if the samples are different enough, we output the average of them in S and V channels, keeping hue from the original center sample. This will effectively displaces image saturation and value at color boundaries.
5. Convert back from HSV to RGB using another volume texture lookup.
Before and after~
Step2~~Edge Detection:
Differ from my old HLSL posts, this time we use pixel's normal and depth to find the edge; if the angle between the normals is big enough(45degree to me), we count it as the edge. Also we compare the difference of the pixel's depth; if the depth difference is big enough, we count it as an edge too. Below is the result i got. It got both silhouette and edge~cool!^_^)b
Result of edge detection~
Finally we combine all the results together and here we have~
Color Distortion + Edge Detection + Hatching~
The most ineteresting part of this demo is the color distortion. I was wondering if I modify the sampling textures, will I get any remarkable change from the result?^^ Oh, one funny part I found out was that I tried rendering the toon effect by first converting the RGB to HSV and adjusted the S and V channels. Because the H was not changed so the result will keep the same color but different saturation and value. The result color was alot softer than the older methods; no those dark and dirty colors~ take a look^_^
Top is old RGB method, Bottom one is the HSV result. What do you think?^^
This is another post-processing demo so as usual we will output the scene color to a texture. But for new edge detection effect, we will need the scene normal and depth as well. So we output the normal as "rgb" and depth as "a" into another texture. And after that we will use these textures to do the post-processing part.
Step1~~Color Distortion:
Use this method to distort the color and make the output look like hand drawing. Steps are:
1. Downsample color texture into a smaller texture.
2. Convert from RGB to HSV color space and quantize color values. This color space conversion is done via a dependent lookup into a volume texture.
3. Sample the same image at 2 displaced positions; using 2 2D offset textures.
Sampling textures~
4. Compare the samples; if the samples are different enough, we output the average of them in S and V channels, keeping hue from the original center sample. This will effectively displaces image saturation and value at color boundaries.
5. Convert back from HSV to RGB using another volume texture lookup.
Before and after~
Step2~~Edge Detection:
Differ from my old HLSL posts, this time we use pixel's normal and depth to find the edge; if the angle between the normals is big enough(45degree to me), we count it as the edge. Also we compare the difference of the pixel's depth; if the depth difference is big enough, we count it as an edge too. Below is the result i got. It got both silhouette and edge~cool!^_^)b
Result of edge detection~
Finally we combine all the results together and here we have~
Color Distortion + Edge Detection + Hatching~
The most ineteresting part of this demo is the color distortion. I was wondering if I modify the sampling textures, will I get any remarkable change from the result?^^ Oh, one funny part I found out was that I tried rendering the toon effect by first converting the RGB to HSV and adjusted the S and V channels. Because the H was not changed so the result will keep the same color but different saturation and value. The result color was alot softer than the older methods; no those dark and dirty colors~ take a look^_^
Top is old RGB method, Bottom one is the HSV result. What do you think?^^
Sunday, April 16, 2006
Ambient Occlusion
Ambient Occlusion(will call it AO in this post~) measures the amount that a point on a surface is obscured from light that might otherwise arrive from the outside. The result of this method will simulate a soft self-shadow to the model and add a great deal of believability to the lighting. In this demo I used both software and hardware implementations as below:
Hemispherical visibility test:
As shown in the picture below, rays are traced outward from a given surface point p over the hemisphere around the normal N. we check if these rays hit any other sufaces to calculate the accessibility of p; the more rays hit other surfaces, the lower the accessibility. And finally we gather all these values and store them in vertex color for rendering.
I used the method above and used random 512 rays per vertex to calculate the vertex color. Due to the software implemetation, the speed of calculating the result was way too slow for real time purpose @_@; But the result was kind of nice~ The rendering results are the pictures below( click to see the original size^^)~
Depth Map Based Ambient Occlusion Lighting:
As below, the 2nd method is to surrounding the scene with a sphere of lights. The light directions are used for sample weighting, while associated depth maps are used for visibility determination. We can see that the lights here are similar as rays in Hemispherical visibility test. After all the shadow map comparisons, we will have the accessibility of all vertices and we can use the scene's texture coordinate as output position to output accessibility as an AO texture. With this texture, we can just use it to render AO without doing calculations again.
Below are the result using Depth map AO rendering. With the support of hardware, the speed of calculating AO improves aaallllooot!( an 512x512 AO map only takes few secs ). One thing worth mentioning is that there are artifacts in the woman's rendering result. This is due to the duplicated vertex normals( could see the lines even if I only do diffuse lighting calculation ). But the sheep didnt have this problem when I rendered it, so there are some restrictions when choosing models for this rendering method.
Render result, notice the artifacts?
The calculated AO map looks like this~
Although Depth map is faster than Hemispherical visibility test, it still can't reach the real time speed. I know there is already a way to render Dynamic AO in GPU Gems2. So both these methods will retire soon~@_@; Yea, I will take some time to see how Dynamic AO works~ ^_^;
Hemispherical visibility test:
As shown in the picture below, rays are traced outward from a given surface point p over the hemisphere around the normal N. we check if these rays hit any other sufaces to calculate the accessibility of p; the more rays hit other surfaces, the lower the accessibility. And finally we gather all these values and store them in vertex color for rendering.
I used the method above and used random 512 rays per vertex to calculate the vertex color. Due to the software implemetation, the speed of calculating the result was way too slow for real time purpose @_@; But the result was kind of nice~ The rendering results are the pictures below( click to see the original size^^)~
Depth Map Based Ambient Occlusion Lighting:
As below, the 2nd method is to surrounding the scene with a sphere of lights. The light directions are used for sample weighting, while associated depth maps are used for visibility determination. We can see that the lights here are similar as rays in Hemispherical visibility test. After all the shadow map comparisons, we will have the accessibility of all vertices and we can use the scene's texture coordinate as output position to output accessibility as an AO texture. With this texture, we can just use it to render AO without doing calculations again.
Below are the result using Depth map AO rendering. With the support of hardware, the speed of calculating AO improves aaallllooot!( an 512x512 AO map only takes few secs ). One thing worth mentioning is that there are artifacts in the woman's rendering result. This is due to the duplicated vertex normals( could see the lines even if I only do diffuse lighting calculation ). But the sheep didnt have this problem when I rendered it, so there are some restrictions when choosing models for this rendering method.
Render result, notice the artifacts?
The calculated AO map looks like this~
Although Depth map is faster than Hemispherical visibility test, it still can't reach the real time speed. I know there is already a way to render Dynamic AO in GPU Gems2. So both these methods will retire soon~@_@; Yea, I will take some time to see how Dynamic AO works~ ^_^;
Sunday, April 02, 2006
Hong Kong Trip
Due to xxx reason ( top secret^^; ) so I had to travel to HongKong during March. hmm? March? Isnt it April now? Thats right, I'm too lazy to re-organzie these pictures and stuff. But if I dont do it, I probably will lose all those memories like I never been to HongKong @_@ So, here goes the 3 days 2 nights trip to HongKong~
March 17th, this was our first time travel by ourselves. To be honest, I was a little nervous ^^; Although I have been to HongKong before with my family, I didnt have any memory of that place...^^; Anyway, here we go Hongkong, me and my girl friend started our trip. When we arrived at HongKong airport, I somehow felt alot better because most people here did understand Manderin. We picked up our luggage and head to our first stop -- Nikko Hotel.
After we leave our luggage in the hotel, we randomly picked a japanese restaurant near the hotel because it was 14:00 already. A nice restaurant tho with decent price~ after the quick lunch, we headed to our 2nd stop -- The Peak Tower! To go there, of course we would take the Peak Tram. Yea, my memory of HongKong was totally no use, I didnt know where we were when we went out from the train station. Thank god there were good people helping us to find the Peak Tram station. Thanks to those poeple ^^
This is what Peak Tram looks like~
Here we go The Peak Tower...What the hell! its redecorating(T_T) what a lucky day. Well, since we were here, lets just look around in the shopping mall next to the tower. And I found this~
After the Peak Tower, it was almost 6 already, so we desided to visit the buzzing centre of clubs -- Lan Kwai Fong. And we finally got lost as usual lol we had no idea where we were, so we had to head back to the train station and started walking from there again. Finally, thank god we found Lan Kwai Fong. This funny place not only have a whole street of pubs but also tons of western people gathering here~ Its like a special scene in HongKong during night time.
Very crowded place~
Pheww~ what a tired day. We also found something funny when we went back to the hotel...what happened to our king size bed?!?
Yup~5 stars!
I had no idea what that is at the bottom...but i didnt dare to touch it because it might cost money. ^^; I kind of challenged that in Japan before so...rather not try again! Water was free tho...duh
March 18th, due to too much walk from the 1st day, our legs didnt belong to us anymore lol. So we changed the travel to a relaxing one. We slept until lunch time lol and went to a buffet for lunch~ But before that, we did a little window shopping at Nathan Road in Tsim Sha Tsui. It was like normal shopping streets with shops on each side of the roads. And we realized something...not only Taiwan has bad air, its the same in HongKong@_@ really! so poisonous... and there were so many busses...poeple of HongKong, can't you smell that??!
Nathan Road~
Another Nathan Road~
God so many busses...^^;
Some people say if you dont ride this train in HongKong, its like you never been to HongKong. So...i think our trip didnt count lol
After our nice buffet, we took a nap in the hotel and then headed to the world's longest covered escalator. It was very long and the scary thing was, there was no escalator if someone wanted to go back, yup its only one way~ We didnt want to lose our legs before going back to the hotel so we only tried a little while and left~
World's longest covered escalator~
Around sunset, we headed to Star Ferry Piers and found these buildings on the way~
Special Scene in HongKong~ during weekends, there will be lots of these Philippine and Thai gathering here, there were so many of them when we saw. I heard they dont have to stay at the working places during weekends so they will gather here and chat or something
Ferry's outfit...Damn man use 92 or 95 please, its so stinky.
I would like to try this...
Here we were Star Ferry Piers
We had our dinner at Star Ferry Piers and were waiting the lazer show around 20:00. But it was a little disappointed. The lazer show between HongKong island and Kowloon was kind of boring and there was no music too. Anyway, we headed to Avenue of Stars after that. There were so many visitors when we got there but it was too dark to see those hand prints on the ground. But not bad tho~ We went back to hotel after Avenue of Stars to relax our feet for tomorrow~
A KongFu man like you shouldnt have small hands like these!
March 19th, our last day. In order to goto the airport on time, we didnt went to any place thats too far from our hotel. We ate some Cantonese style breakfast and headed to the Ladies Market in Kowloon. ( was planning to eat their Dimsum but those restaurants seemed opened pretty late on Sunday ; ; )
I really wanted to know whats #A...( it's written "good morning everyone" what meal is that??! )
Ladies Market. We were too early i think. Many store were just opening when we got there~
Oh, there 2 were very tasty. I forget the name of the store but their sweets are really good~ left one is mango with rice ball, and the right one is water melon with honey. Those 4 red balls were water melons! really tasty ^_^
Why did i have to be so tired ^^; I wanted a relax trip!
Finally time to go home~ We headed back to hotel and picked up our luggages. When we were waiting the shuttles, we found these 2 funny food~ right hand one is curry fish eggs and the left hand one is some cake~ unlike the one in taiwan, its crunchy and is empty inside. Very tasty too!! ^^
Wooohaa~finally the conclusion lol. HongKong and Taiwan have many similar cultures; Bad air, dirty street... lol I think its the last time for me to travel there =P And I really hate this leg breaking kind of trip~ In the future I will try more relaxing trips like going to howaii or something~
March 17th, this was our first time travel by ourselves. To be honest, I was a little nervous ^^; Although I have been to HongKong before with my family, I didnt have any memory of that place...^^; Anyway, here we go Hongkong, me and my girl friend started our trip. When we arrived at HongKong airport, I somehow felt alot better because most people here did understand Manderin. We picked up our luggage and head to our first stop -- Nikko Hotel.
After we leave our luggage in the hotel, we randomly picked a japanese restaurant near the hotel because it was 14:00 already. A nice restaurant tho with decent price~ after the quick lunch, we headed to our 2nd stop -- The Peak Tower! To go there, of course we would take the Peak Tram. Yea, my memory of HongKong was totally no use, I didnt know where we were when we went out from the train station. Thank god there were good people helping us to find the Peak Tram station. Thanks to those poeple ^^
This is what Peak Tram looks like~
Here we go The Peak Tower...What the hell! its redecorating(T_T) what a lucky day. Well, since we were here, lets just look around in the shopping mall next to the tower. And I found this~
After the Peak Tower, it was almost 6 already, so we desided to visit the buzzing centre of clubs -- Lan Kwai Fong. And we finally got lost as usual lol we had no idea where we were, so we had to head back to the train station and started walking from there again. Finally, thank god we found Lan Kwai Fong. This funny place not only have a whole street of pubs but also tons of western people gathering here~ Its like a special scene in HongKong during night time.
Very crowded place~
Pheww~ what a tired day. We also found something funny when we went back to the hotel...what happened to our king size bed?!?
Yup~5 stars!
I had no idea what that is at the bottom...but i didnt dare to touch it because it might cost money. ^^; I kind of challenged that in Japan before so...rather not try again! Water was free tho...duh
March 18th, due to too much walk from the 1st day, our legs didnt belong to us anymore lol. So we changed the travel to a relaxing one. We slept until lunch time lol and went to a buffet for lunch~ But before that, we did a little window shopping at Nathan Road in Tsim Sha Tsui. It was like normal shopping streets with shops on each side of the roads. And we realized something...not only Taiwan has bad air, its the same in HongKong@_@ really! so poisonous... and there were so many busses...poeple of HongKong, can't you smell that??!
Nathan Road~
Another Nathan Road~
God so many busses...^^;
Some people say if you dont ride this train in HongKong, its like you never been to HongKong. So...i think our trip didnt count lol
After our nice buffet, we took a nap in the hotel and then headed to the world's longest covered escalator. It was very long and the scary thing was, there was no escalator if someone wanted to go back, yup its only one way~ We didnt want to lose our legs before going back to the hotel so we only tried a little while and left~
World's longest covered escalator~
Around sunset, we headed to Star Ferry Piers and found these buildings on the way~
Special Scene in HongKong~ during weekends, there will be lots of these Philippine and Thai gathering here, there were so many of them when we saw. I heard they dont have to stay at the working places during weekends so they will gather here and chat or something
Ferry's outfit...Damn man use 92 or 95 please, its so stinky.
I would like to try this...
Here we were Star Ferry Piers
We had our dinner at Star Ferry Piers and were waiting the lazer show around 20:00. But it was a little disappointed. The lazer show between HongKong island and Kowloon was kind of boring and there was no music too. Anyway, we headed to Avenue of Stars after that. There were so many visitors when we got there but it was too dark to see those hand prints on the ground. But not bad tho~ We went back to hotel after Avenue of Stars to relax our feet for tomorrow~
A KongFu man like you shouldnt have small hands like these!
March 19th, our last day. In order to goto the airport on time, we didnt went to any place thats too far from our hotel. We ate some Cantonese style breakfast and headed to the Ladies Market in Kowloon. ( was planning to eat their Dimsum but those restaurants seemed opened pretty late on Sunday ; ; )
I really wanted to know whats #A...( it's written "good morning everyone" what meal is that??! )
Ladies Market. We were too early i think. Many store were just opening when we got there~
Oh, there 2 were very tasty. I forget the name of the store but their sweets are really good~ left one is mango with rice ball, and the right one is water melon with honey. Those 4 red balls were water melons! really tasty ^_^
Why did i have to be so tired ^^; I wanted a relax trip!
Finally time to go home~ We headed back to hotel and picked up our luggages. When we were waiting the shuttles, we found these 2 funny food~ right hand one is curry fish eggs and the left hand one is some cake~ unlike the one in taiwan, its crunchy and is empty inside. Very tasty too!! ^^
Wooohaa~finally the conclusion lol. HongKong and Taiwan have many similar cultures; Bad air, dirty street... lol I think its the last time for me to travel there =P And I really hate this leg breaking kind of trip~ In the future I will try more relaxing trips like going to howaii or something~
Subscribe to:
Posts (Atom)