Sunday, September 30, 2012

Pushing to Git returning Error Code 403 fatal

Pushing to Git returning Error Code 403 fatal: HTTP request failed

Why:
Github seems only supports ssh way to read&write the repo, although https way also displayed 'Read&Write'. So you need to change your repo config on your PC to ssh way:

Solution:
  1.  Manually edit .git/config file under your repo directory. Find url=entry under section [remote "origin"]. Change all the texts before @ symbol to ssh://git. Save config file and quit. now you could use git push origin master to sync your repo on GitHub
  2.  Another solution is just use shell command:
git remote set-url origin ssh://git@github.com/username/projectName.git

Interactive Camera and specular reflection

  • Interactive Camera
Interactive camera is done. Now the camera position can be controled by keyboard input.
Keys:
      'W': move forward(in Z direction)
      'S': move backward(in Z direction)
      'A': move to left
      'D': move to right
      'U': up
      'I': down

  •  Specular Relection
Specular not correct, still working on it.


Reflection not right:

Without reflection:

Wierd Pattern on the Back Wall

Feautures implemented:
  • Raycasting from a camera into a scenen through a pixel grid
  • Phong lighting for one point light source
  • Diffuse lambertian surfaces
  • Raytraced shadows
  • Cube intersection testing
  • Sphere surface point sampling
I don't know what happened to that wall. The diffuse and  ambient


Finally, I found out why. It is because I used EPSILON in the box-ray intersection set when the ray parrelle with one plane. EPSILON is defined as 0.000000001, which seems too small for a float number camparation. I have changed it to 0.001. 
Now, the picutre looks like this:



Friday, September 28, 2012

Raycast and box-ray intersection


Basic raycast from camera and box-ray intersection finished. At this point, I can get a 2D picture now.
  • Raycast:
Use the caculation steps from Computer Graphic course.
Raycast direction test:

Here is a screen shot of one of the images I got,flat shading: 

  •  Box-ray intersection
I used the slab algorithm. The link is posted on the previous blog.

Thursday, September 27, 2012

CUDA GPU Ray Tracer

This is a course project for CIS 565.
  •  Ray Tracing

Basic Algorithm: For each pixel, shoot a ray into the scene. Check intersections for the ray. If  intersection happens, cast a shadow ray to light source to see if the light source is visible and shade the current puxel accordingly. If the surface is diffuse, the ray will stop there. If it is reflective, shoot a new ray reflected across the normal from teh incident ray. And repeat over until reached the tracing depth or the ray hits a light or diffuse surface.

Folowing is a picture demonstrates how ray tracing algorithm works.(grab from wikipedia)

 Since CUDA does not support recursion, we need to use Iterative Ray-tracing.
Useful link: http://en.wikipedia.org/wiki/Ray_tracing_%28graphics%29
  • Box-ray intersection
I use slab method to check box-ray intersection.
Useful link: http://www.siggraph.org/education/materials/HyperGraph/raytrace/rtinter3.htm
  • Sphere surface point sampling
I used spherical coordinates for sphere surface point sampling.
Useful link: Wolfrat Math World: http://mathworld.wolfram.com/SpherePointPicking.html