• Create Account

# CulDeChu

Member Since 07 Nov 2010
Offline Last Active Yesterday, 06:43 AM

### #5275190Find triangles half of surface, and tetrahedron half of volume

Posted by on 10 February 2016 - 05:42 PM

For cutting a triangle in half, based on your image, the dimensions of the cut are like so:

The same thing goes for pyramid with a triangle base, otherwise known as a 3-simplex. Multiply the height of the triangle by sqrt(2)/2 and that's how far down from the tip you have to go before you can cut perpendicularly to get a 3-simplex with half the volume

### #5259494Finding the current average of an indefinitely increasing sequence

Posted by on 28 October 2015 - 07:46 PM

Another really simple way to do it is to do

```newAverage = prevAverage * (i - 1) / i + newValue / i;
```

, where i starts at 1 and increments after every time you want to add something to the running average. Granted, this is only as good as the floating point precision you're using, but then again, that could be said about almost everything

### #5246508PBR specular BRDF

Posted by on 14 August 2015 - 11:26 AM

So if I understand what you're asking, you're wanting to know why you don't just calculate the specular reflection vector and grab the texel of the environment map that corresponds and use that as the specular value?

There's a couple of reasons.

First of all, BRDFs talk about more than just reflections and blurriness. They also talk about normalization factors. Just grabbing different mipmap levels won't account for, say, the Geometry term, the computations must be done separately.

Also, from a more path-tracing perspective, you also have to take in all the other things that a microfacet model describes, like grazing reflections and stuff. These effects can't be covered as easily as just grabbing a reflection vector.

Anyways, hope this helped clear some stuff up!

### #5245328Does anyone know a in depth tutorial using GLFW and GLEW?

Posted by on 09 August 2015 - 06:13 PM

There's an absolutely fantastic set of GLFW + OpenGL 4.x tutorials made by GDNet member japro: https://github.com/progschj/OpenGL-Examples

He uses GLXW instead of GLEW, but GLEW is usually not that hard to set up in MSVC++. It's just including a couple libraries and headers and calling glewInit() after getting everything right.

### #5245176Tinted bloom?

Posted by on 08 August 2015 - 08:43 PM

EDIT: BTW I'm not terribly sure how would you detect where the ray hits the light disc? Some intersection function?

Yes, with an intersection function. A disc is always planar. You have to chose a point on a plane to test against anyway, so you can just do:

```t = distFromPlane(discCenter, discNormal, rayOrigin, rayDirection)
hitPos = rayOrigin + rayDirection * t;
if (length(hitPos -  discCenter) >= discRadius)

distFromPlane(discCenter, discNormal, rayOrigin, rayDirection):
if (dot(rayDirection, discNormal) >= 0)
return 0;
return dot(discCenter - rayOrigin) / dot(rayDirection, discNormal);

```

### #5236325Is Horror Possible From a Top Down Perspective

Posted by on 23 June 2015 - 07:36 AM

There's a ton of examples of well done horror top-down games. A great many of them were made in RPGMaker back when that was really popular. Corpse Party, Ib, The Witch's House, Mad Father, etc are all fantastic examples.

The way I saw horror done in those games is a mixture between gory cutscene art/narratives and jump scares mostly, which is about all you can do. The issue is that perspective is really fighting you in a lot of cases, especially in the art direction. What you lose in scary monster art you gain in being able to set up environmental atmosphere that might not be possible in first person effectively, and top-down horror games tend to keep that in mind.

### #5227649GI ground truth for comparison

Posted by on 06 May 2015 - 09:14 PM

I also don't like Blender Render because of all the thousands of presets that do things I'm not accounting for. Basically, it's hard to use for just making a simple test scenes to render.

Thought you don't like blender, it comes to (my) mind first. Blender's cycle, starting with a simple diffuse only material and some light sources. It is a path tracer and should deliver a pretty solid GI solution.

That's true, blender cycles is really nice and easy to use, much less painful than normal blender render used to be.

Also, on the topic of physical based vs correctness, that's very true. The big thing for me, though, is having results that agree with everyone else's results.

Isn't POVRay a common choice for this sort of thing?

That's the crux of the matter, I don't know if it is or not. Thanks for the advice!

Arnold is very good, but also very not-free.

I've had some people recommend LuxRender, but I don't really have any experience with it myself.

Have you thought about writing a quick exporter tool to Mitsuba's file format? If you can do that, you can totally skip the pain of manually editing XML files. In fact I wasn't really advocating that you hand-write the XML in my blog post, I was just doing it as a way help familiarize people with the format and Mitsuba's functionality.

LuxRender looks fantastic, and Arnold looked amazing too in last year's SIGGRAPH!

The XML-exporting thing is a valid point, and it's something I could do. I've been using it to set up very simple scenes, so it doesn't matter too much as of right now, I was wondering for future alternatives. I'll look into LuxRender and POVRay though.

Regardless, if the hug variety of pathtracing programs out there really aren't to your liking you could practice and write your own, if it means that much to you.

Funny enough, I did, and I'm not sure if the results from my pathtracer are accurate either. Kind of a catch 22

### #5227240GI ground truth for comparison

Posted by on 04 May 2015 - 11:41 PM

Hello there!

So I've been wanting to put my renders up next to something for a comparison to test for correctness. It'd really be helpful if I could have a ground-truth form of the renders I'm doing. After all, being "Physically Based" sort of implies that it your renders sort of look correct

I've tried some things, and I've heard of other things,

- I've tried Mitsuba, as per MJP's advice, but I really can't get into it. It's good, but the XML is ridiculously obtuse and word-y.

- I also don't like Blender Render because of all the thousands of presets that do things I'm not accounting for. Basically, it's hard to use for just making a simple test scenes to render.

- I haven't yet tried Pixar's now-public Renderman, but I'm going to try that one out soon.

- I've read that Cinema4D has it all, but it's a little on the extremely pricey side

What sort of GI programs do you use, or would recommend, for comparing renders against?

### #5226703Which is the best university in the "world" for Computer Graphics?

Posted by on 01 May 2015 - 08:19 AM

I think the institution you're looking for is the Internet. It's an impressive thing, really: it's the largest collection of human thought ever constructed, and most of it is completely free to the public!

If you really want to get started with realistic graphics, chances are you want to start taking a look at SIGGRAPH papers, GPU Gems, read developer's blogs and the like. That'll probably a much better teacher than you could ever get at a university, IMO.

### #5213949An alternative to the Sponza mesh for demos?

Posted by on 02 March 2015 - 10:26 AM

My personal favorite is a San Miguel scene that I've seen used a few times. A bunch of really nice ones are listed here: http://graphics.cs.williams.edu/data/meshes.xml

### #5213934Delaunay Traingulation

Posted by on 02 March 2015 - 09:38 AM

Now I'm struggling to produce a Delaunay Traingulation.  I'm trying to make my initial set of triangles by adding points randomly to the grid.  If the point is inside of the triangle, then the triangle splits into three smaller triangles.  If it is outside of another triangle then it finds the two nearest points and makes a new triangle with them.

This is not working at all.

I'm not sure what's wrong with this, because this is completely correct, at least to create an arbitrary triangulation. You don't need to know baycentric coordinates to make it work, though. If your triangles are in counter-clockwise winding, a triangle with verts A, B, and C would be split as such: http://i.imgur.com/PNNEtkf.png

I've seen this concept of edge flipping in my travels.  I haven't been able to wrap my head around it well enough to turn it into code. Do you have a simplish explanation for what is going on?

Sure, I'll take a whack at it.

There are many ways to triangulate a set of points. Delaunay triangulation is a specific type of triangulation that seeks to maximize the minimum angle of each triangle, to avoid skinny triangles. Now, this doesn't necessarily mean that it's the correct or the only way of avoiding skinny triangles, it's just one method. See here for a more complete list of different ways to create optimal triangulations: http://en.wikipedia.org/wiki/Point_set_triangulation#Time_complexity_of_various_algorithms

So, in an effort to maximize the minimum angle, and taking advantage of the Delaunay property of circles, the easiest way to go about turning a random triangulation into a Delaunay one is to compare and correct adjacent triangles together. Something like:

```for every pair of adjacent triangles
if they aren't delaunay
make them delaunay
```

, which is actually really nice. Not many other triangulation methods that I know of become correct just by correcting triangles piecewise like this.

The "make delaunay" step is the key here. It just so happens that the easiest way to make a non-Delaunay pair of adjacent triangles correct again is to turn the exterior vertices into interior vertices and vice versa

Hope that helped a little!

### #5213836Delaunay Traingulation

Posted by on 02 March 2015 - 02:01 AM

Just a quick question, do you want a Delaunay Triangulation, like your title suggests, or do you want a Voronoi mesh, like your post suggests? If you're calculating a Voronoi with the end goal of turning it into a Delaunay, then there are far easier ways to do it.

The only issue with your Voronoi algorithm is that your first step essentially requires you to make a Delaunay triangulation. Keep in mind that just because you can find create an arbitrary triangulation over a set of points doesn't mean that you are creating the inverse of the corresponding Voronoi diagram, which is what you need. Everything else about it seems like it should do the trick.

Fortunately, you can construct a Delaunay very easily by:

1) creating an arbitrary triangulation. There are many ways to do this, but the easiest way is to append and subdivide triangles as you add points to the triangulation. I can elaborate on that if you need.

2) edge flip 'till you can't flip no more ( http://en.wikipedia.org/wiki/Delaunay_triangulation#Visual_Delaunay_definition:_Flipping )

Hope this helps!

### #5209627Vector-based vs Tile-based worlds

Posted by on 09 February 2015 - 11:18 AM

Heyy all!

I'm starting to think that a vector-based world would make the game I'm creating look and feel magnitudes better. I'm going to try it out regardless, but I have bad memories of the last time I tried to make a non-tile based 2D platformer. It wasn't exactly a pleasant experience, so I'd like to know what you guys think.

For reference, here's an older video of the type of game I'm making:

Here's what I mean by vector-based worlds: http://higherorderfun.com/blog/wp-content/uploads/2012/05/Talbot_Bitmask_2.png. You know, games that don't just use tiles to block out the game world.

So, without a shadow of a doubt, tile based worlds are much easier to make, and much easier iterate upon. Unfortunately, they don't look as gorgeous as fully vector-ized ones. Tile-based editors like Tiled have functionality that allows you to create tile objects (like a platform), give them properties (like following a path or using a lua script), and other things that can make the process go a lot more smoothly.

So, last time I tried making a game without tiles or bricks, I used Illustrator to make the files, exported them as .SVGs, and parsed those to load game levels. Because there's no properties, I had to resort to naming layers to denote what objects had which properties (as names in SVG files could be easily parsed). But it all felt very hack-y, you know?

What are your experiences with vector-based game worlds? Did you ever find a good solution to the issues of:

• a good vector-art program that's both fully SVG compliant (or compliant enough to relieve you of headaches, unlike Illustrator) and actually nice to work with?
• world content generation (like procedural generating grass, flowers, etc to reduce the art generation burden)
• texturing (because SVG doesn't really like texturing things, and especially doesn't like smooth transitioning texturing between different textures)
• attaching scripts or other properties to different objects (like platforms, doors, enemies, etc)
• ease of prototyping (cause let's face it, tile-based worlds are easy because, just looking at it, you can see whether or not it'll work. With vector-based overworlds, not as much)
• other things I'm forgetting or haven't realized yet?

### #5204231Explain the shape of a specular lobe

Posted by on 14 January 2015 - 10:50 AM

The results look about right, if you take the x-axis to be the surface normal, and the specular power to be around 5 to 8 or so, it looks about right.

### #5204135Explain the shape of a specular lobe

Posted by on 13 January 2015 - 10:24 PM

Well, a function that you can plot won't really help you much when you're trying to do any sort of graphics programming. But if you *really* want a plot-able function, you can always take the phong equation for specular highlights, which goes something like

finalSpecColor = specColor * pow(dot(normal, halfAngle), specTerm)

where

halfAngle = normalize(viewDirection+lightDirection)

Once you have that, you can easily write a little program that steps through a bunch of different possible view directions on the unit circle and comes up with a simple plot of the outcome.

EDIT: I went ahead and made a quick little thing that shows the phong specular lobe for a given specular power. Mouse over to change the reflection direction  https://dl.dropboxusercontent.com/u/45553463/thing/index.html

PARTNERS