Jump to content

  • Log In with Google      Sign In   
  • Create Account

Yann ALET

Member Since 11 Jun 2008
Offline Last Active Oct 08 2014 12:39 PM

Posts I've Made

In Topic: Poor STL threads performance

19 September 2014 - 10:12 AM

Do you actually split the work between the threads or do you simply multiply the work with every thread?

 

Not sure what you mean, but i tried multiple approaches.

The one i wrote above, and this one too :

 

for(int m_prime = 0; i < N; i++)

{

     threads.push_back(std::thread(&Ocean::DoFFT, this, 1, m_prime * N));

     if(threads.size() == 4)

     {

           //.. join all 4 threads before moving to the next batch.

     }

}

 

But like Hogman mentioned, i am spawning 64 threads even with this approach, i'll just create some kind of threadpool of 4 permanent threads instead.

 

Side question though, assuming i make this thing work properly with expected fps boost, would i get better performance with OpenMP (so code still executed on CPU), or should i jump directly to a OpenCL implementation ?

 

Thanks for your help !


In Topic: Poor STL threads performance

19 September 2014 - 07:37 AM

 

(went from 16fps to 5fps in Debug)


I don't think a statement about speed is at all viable when talking about MSVC's Debug builds. Debug builds are for finding bugs, not testing the speed of anything.

 

Sure, but as my reference fps was also in debug, i figured i could compare apples to apples.

I'll keep that in mind though :-)


In Topic: Poor STL threads performance

19 September 2014 - 07:36 AM

Creating and destroying threads are costly operations. You ideally want to have a small number of permanent threads (about the same number has you have hardware-threads) and keep them busy over the life of your app.

 

Hummm interesting, i'll try this when i get home then, thanks !


In Topic: Help with Smooth Gradient on Skydome

23 March 2014 - 02:34 PM

Have you thought about sampling a sky gradient texture instead ?

Something like this


In Topic: Good specular for water surface

20 March 2014 - 08:46 PM

Thanks a lot for your response Bacterius !

So following your advice, i bumped the shininess ...

 

To 200

http://imgur.com/6G1Pv5S

 

To 2000

http://imgur.com/9mJuujo

 

To 7000

http://imgur.com/KXaNaBU

http://youtu.be/A34orUkXP7Q

 

This is much better !

I wonder why my specular effect is located on such a small area though, i'll try to tweak my shader a bit to come up with a better algorithm.

 

Regarding the sharpness of my waves, that's why i increased my grid resolution, and added a height map, it did not help a lot though.

 

And regarding color absorption in water, i am actually handling that with this function which i wrote based on this article.

sandColor = GetWaterColorAt(sourceColor, distance);

//...

float3 GetWaterColorAt(float3 sourceColor, float depth)
{
float rIndex = 7.0f;
float gIndex = 10.0f;
float bIndex = 70.0f;

float sandRed = sourceColor.r;
float sandGreen = sourceColor.g;
float sandBlue = sourceColor.b;

float lostRed = (depth / rIndex) * (1.0f/3.0f);
float lostGreen = (depth / gIndex) * (1.0f/3.0f);
float lostBlue = (depth / bIndex) * (1.0f/3.0f);

sandRed = sandRed - (sandRed * lostRed);
sandGreen = sandGreen - (sandGreen * lostGreen);
sandBlue = sandBlue - (sandBlue * lostBlue);

float3 sandColor = float3(max(0, sandRed), max(0, sandGreen), max(0, sandBlue));
return sandColor;
}

I'll try to add caustic and reflection to see if i get better results.

 

Thanks again !


PARTNERS