Peer-to-Peer Forum

 

Login Register    
vpEnvCloudVolume (sort puffs by depth to observer)
Posted: 19 October 2010 07:20 AM  
Newbie
Rank
Total Posts:  9
Joined  2010-10-15

Hi, is it possible to override default rendering behavior of vpEnvCloudVolume to sort puffs by depth to observer? What the best way to do it?

Thanks.

 
Posted: 03 November 2010 09:42 AM   [ # 1 ]  
Newbie
Rank
Total Posts:  9
Joined  2010-10-15

Looks like the forum is pretty dead. We found an easy solution to sort cloud puffs, now looking how to sort clouds.

CloudVolumeDepthSorter.h

#pragma once

class CloudVolumeDepthSorter
{
    
class vpEnvCloudVolumeHack : public vpEnvCloudVolume {friend class CloudVolumeDepthSorter;};

    
typedef std::pair<doublevpEnvCloudVolumeHack::Puff*> PuffDepth;
    
typedef std::vector<PuffDepthSortedPuffs;

    static 
inline bool ComparePuffDepth(PuffDepthaPuffDepthb{return (a.first b.first);}

public:

    
CloudVolumeDepthSorter();
    
void Update();
    
void SortCloud(vpEnvCloudVolumeHackcloud, const vuVec3<float>& campos);

private:

    
vpEnvCloudVolumeHack::Puffs m_puffs;
    
SortedPuffs m_sorted;
    
float m_sort_rate;
    
float m_sort_accum;
}

CloudVolumeDepthSorter.cpp

CloudVolumeDepthSorter::CloudVolumeDepthSorter()
{
    m_sort_rate 
0.5f;
    
m_sort_accum m_sort_rate 1.0f;
}

//
// TODO: 
// sort only visible puffs only when observer position changed
// do something with hardcoded myObserver
//
void CloudVolumeDepthSorter::Update()
{
    
const float dt vpKernel::instance()->getSimulationDeltaTime();
    
m_sort_accum += dt;
    if (
m_sort_accum m_sort_rate{
        m_sort_accum 
0.0f;

        
vpObservercam vpObserver::find("myObserver");
        
double cxcycz;
        
cam->getTranslate(&cx;, &cy;, &cz;);
        
vuVec3<floatcampos(cxcycz);

        
vpEnvCloudVolume::const_iterator iiend;
        for (
vpEnvCloudVolume::begin(), iend vpEnvCloudVolume::end(); != iend; ++i{
            vpEnvCloudVolume
cloud = *i;
            
SortCloud((vpEnvCloudVolumeHack*)cloudcampos);
        
}
    }
}

void CloudVolumeDepthSorter
::SortCloud(vpEnvCloudVolumeHackcloud, const vuVec3<float>& campos)
{
    vpEnvCloudVolumeHack
::Puffspufvec cloud->m_puffs;
    const 
size_t npuffs pufvec.size();

    
m_puffs.clear();
    
m_puffs.swap(pufvec);
    
m_sorted.clear();
    
m_sorted.reserve(npuffs);

    
double xyz;
    
cloud->getTranslate(&x, &y, &z);
    
vuVec3<floatpufpos;

    
vpEnvCloudVolumeHack::Puffs::iterator iiend;
    for (
m_puffs.begin(), iend m_puffs.end(); != iend; ++i)
    
{
        vpEnvCloudVolumeHack
::Puffpuff = *i;
        
pufpos puff.m_position;
        
pufpos[0] += x;
        
pufpos[1] += y;
        
pufpos[2] += z;

        const 
double distsq campos.distanceSq(pufpos);
        
m_sorted.push_back(PuffDepth(distsq, &puff;));
    
}

    std
::sort(m_sorted.begin(), m_sorted.end(), ComparePuffDepth);

    
SortedPuffs::iterator jjend;
    for (
m_sorted.begin(), jend m_sorted.end(); != jend; ++j)
    
{
        pufvec
.push_back(*(j->second));
    
}
Image Attachments  Clipboard04.jpg
 
Posted: 04 November 2010 06:33 AM   [ # 2 ]  
Member
RankRankRank
Total Posts:  79
Joined  2007-07-23

Hmmm ... thanks.  I’ll probably neeeever need this, but I’m gonna steal it anyway grrr

Can I ask ... “What is wrong with the default sorting?”  Why aren’t the random puffy clouds useful?

chas

 
Posted: 04 November 2010 06:34 AM   [ # 3 ]  
Member
RankRankRank
Total Posts:  79
Joined  2007-07-23

btw,
the forum isn’t dead ... everybodys got dandruff.
chas

 
Posted: 04 November 2010 07:01 AM   [ # 4 ]  
Newbie
Rank
Total Posts:  9
Joined  2010-10-15

By default puffs displayed without any sorting, just in order they where added into container. That looks horrible from different positions.

 
Posted: 04 November 2010 12:00 PM   [ # 5 ]  
Member
RankRankRank
Total Posts:  79
Joined  2007-07-23

Hmmmm ... ok
thanks

 
Posted: 08 November 2010 04:34 PM   [ # 6 ]  
Member
RankRankRank
Total Posts:  78
Joined  2009-01-15

There’s talk of supporting Sundog’s SilverLining Clouds and hopefully other environmental features in the future.  More (much more) realistic clouds are on the horizon.  (yes that was a pun!)

Steve

 
Posted: 09 November 2010 04:27 AM   [ # 7 ]  
Newbie
Rank
Total Posts:  9
Joined  2010-10-15

SilverLining demo scene looks nice, but requires a lot of processing power, on GTX 295 with cloud coverage 30% frame rate is 30-40 FPS when rotating/moving camera.

 
Posted: 09 November 2010 08:14 AM   [ # 8 ]  
Member
RankRankRank
Total Posts:  79
Joined  2007-07-23

The silverlining stuff looks good ... nice and puffy, but I prefer the look of the cloud decks generated by winMark.  Also, the deformation is better.  Let’s get the two techniques together .... silverMark!

chas

 
Posted: 09 November 2010 10:16 AM   [ # 9 ]  
Member
RankRankRank
Total Posts:  78
Joined  2009-01-15
whitleychas - 09 November 2010 08:14 AM

The silverlining stuff looks good ... nice and puffy, but I prefer the look of the cloud decks generated by winMark.  Also, the deformation is better.  Let’s get the two techniques together .... silverMark!

chas

I couldn’t find anything on google for winMark.  Is there a website you can point us to?

 
Posted: 09 November 2010 12:55 PM   [ # 10 ]  
Member
RankRankRank
Total Posts:  79
Joined  2007-07-23

http://www.windwardmark.net/

 
Posted: 09 November 2010 01:35 PM   [ # 11 ]  
Member
RankRankRank
Total Posts:  79
Joined  2007-07-23

Presagis uses windwardMark’s products.

 
Posted: 09 November 2010 02:04 PM   [ # 12 ]  
Member
RankRankRank
Total Posts:  78
Joined  2009-01-15

The current planar clouds display a rorschach “inkblot” pattern if you watch closely.  We tried the 3D clouds but ended up not using them because they didn’t provide the visual fidelity we needed.  We purchased Silverlining at the beginning of the year in anticipation that WE would incorporate it ourselves and just not include the standard Vega Prime environmental classes.  Turns out that Presagis had the same idea.  Early this year we told them we were going to use Silverlining.  One of our customers is very interested in “real” weather patterns, so much so that we are investigating common network and/or DIS interfaces for weather.  Apparently there are weather interfaces called GRIB1 and GRIB2. 
Silverlining uses particles and I think the volume clouds Vega Prime uses are meshes.

Steve

 
Posted: 09 November 2010 04:04 PM   [ # 13 ]  
Member
RankRankRank
Total Posts:  79
Joined  2007-07-23

I’ve got vp running on a 10’ radius dome, 240 x 60 degree ... ground sim ... the clouds look great !!  And I like the interacton with the wind.  A heterogenous environment would be a great addition.

chas

 
Posted: 18 November 2010 01:58 PM   [ # 14 ]  
Member
RankRankRank
Total Posts:  78
Joined  2009-01-15

Our flight sim application gets us too close to the clouds so the issues are more apparent.

 
Posted: 03 May 2011 11:11 AM   [ # 15 ]  
Member
RankRankRank
Total Posts:  78
Joined  2009-01-15

Was starting to look into WindWardMark and their two cloud and atmosphere products but looks like they are out of business.  Both phone and web site are seriously out of date.