Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


allingm

Member Since 30 Oct 2009
Offline Last Active Nov 16 2014 11:26 PM

Topics I've Started

Normalizing the Fresnel Equation

05 April 2013 - 04:58 PM

So, you are supposed to normalize a BRDF equation so that it sums to 1 over the hemisphere.  It seems that everybody goes out of their way to normalize the NDF portion; however, I was wondering about the other portions.  Wouldn't it make sense to normalize the whole equation including the Fresnel term for example?  I did some Google searching and came across this:

 

http://seblagarde.wordpress.com/2011/08/17/hello-world/

"When working with microfacet BRDFs, normalize only microfacet normal distribution function (NDF)"

 

…but then I ask myself, why?  The writer doesn’t seem to give any explanation why.  Does anybody know?


Cook-Torrance’s BRDF

03 April 2013 - 03:46 PM

I’m having trouble understanding Cook-Torrance’s BRDF fundamentals.  The function is:

 

F * G * D

----------------

4 * N.L * N.V

 

My question is where do the N.L and N.V come from?  The main reason I ask is the N.V is giving me trouble.  I know that the N.L goes away when we multiply the BRDF by the N.L and the incoming light intensity, but N.V remains and causes problems for me.  The objects in my scene have bright halo/sparkles around them.  Perhaps this isn’t even supposed to be a problem?  I would like a deeper understanding, so I can figure out what is going wrong.


bug in dlmalloc or just misunderstanding?

09 February 2012 - 03:10 PM

Hey guys,

I was testing my code and found that when I allocated a certain size chunk and then freed it there was some left over. I'm using dlmalloc as my allocator. I finally boiled it down to a reproducible example, but am I just not understand what info.uordblks means?

code:

#include "malloc.h"
#include <cstdio>

int main( void )
{

dlfree( dlmalloc( 10 ) );
void * data = dlmalloc( 174904 );
dlfree( data );
mallinfo info = dlmallinfo();
printf( "%d\n", info.uordblks );

getchar();

}

The documentation says /* total allocated space */ for uordblks.

The print statement says there is 40 left over.

volatile and pods (and atomics)

24 January 2012 - 05:08 PM

So, I was writing my own atomic<T> type and started having trouble with respect to classes. I looked up online and realized that this wasn't something I actually wanted. However, http://www.stdthread.co.uk/doc/headers/atomic/atomic.html says that the STL atomic type can work on pods and built in types. I continued with pod support, but still had trouble. If I do the following I still get trouble:

struct POD
{
double x;
double y;
};

volatile struct POD a;
struct POD b;

a = b; //C2678
b = a; //C2679

Should I drop POD support or am I doing something wrong.

By the way I'm using volatile to force a memory read.

template< typename T >
T ForceRead( volatile T * x )
{
T result = *x;
return result;
}

template< typename T >
inline T AtomicLock< T >::Load( void ) const //an atomic type that uses a lock
{
T result;

mMutex.Lock();
result = ForceRead( &mData );
mMutex.Unlock();

return result;
}

Multithreading Jobs Pool Library

08 December 2011 - 03:45 PM

Hey guys,

Last time I came on here you guys pointed me to some good code. I was wondering if you guys know where I can find a free library that is a multithreading library that supports the job pool (aka work queue) technique. I want to integrate multi-threading into my engine. I looked online and I found a post that is almost exactly what I was thinking: http://stackoverflow.com/questions/565137/multithreaded-job-queue-manager I'm wondering if I'll just have to write my own implementation. If that is the case does anybody have any book recommendations?

Thanks

PARTNERS