frankH Posted May 11, 2005 Posted May 11, 2005 i can assure you that we need a good terrain wizard for the movie project were on to. Greetings Frank Quote
jpappas Posted May 11, 2005 Posted May 11, 2005 Anders, I've been looking at the Terragen homepage and wow, the landscapes do look incredible! But it doesn't look like the easiest program to learn and I'm starting to lean towards hoping for a better all in one solution in AM. What concerns me about compositing the two programs together is I can imagine wanting to do an AM animation using a character surrounded by some terrain, and wanting to do all sorts of camera moves, panning, rotating, maybe different camera angle cuts, or having an AM camera track a character, etc... But Terragen's camera control seems to be script based, controlled by a dialog -- so we would be giving up alot of AM's useful camera control. I've heard SynthEyes is good at tracking camera moves but that would be a one way solution, from Terragen as input to AM as output. Again, it would be the same problem. Does this seem like an obstacle or did you envision the two programs working together another way? -Jim Quote
aaver Posted May 11, 2005 Author Posted May 11, 2005 [...]Does this seem like an obstacle or did you envision the two programs working together another way? In my opinion, it shouldn't be too hard to export A:M's camera data into Terragen. I might be wrong, but I really don't see this as one of the greater problems. Terragen using polygon displacements is my biggest concern regarding compositing. I haven't had time to find out whether it does, though. Quote
brainmuffin Posted May 18, 2005 Posted May 18, 2005 Yes, I'd like to see the terrain wizard improved, I think the terrain wizard just needs some better functions. and here's what I'd really like to see texture wise: http://www.hash.com/forums/index.php?act=S...t=0#entry107285 There isn't much you can't do with terrains if you have a good slope combiner... Can terragen export the terrain data as a grayscale map? Most terrain generators can, and you can put that map in A:M's terrain Generator and get decent results... Here's my terrain from the slope combiner thread imported into A:M via the terrain Wizard (with the same map applied as a displacement map): Quote
Admin Rodney Posted May 18, 2005 Admin Posted May 18, 2005 In my opinion, it shouldn't be too hard to export A:M's camera data into Terragen. Someone did just this (or the reverse) about a year ago. As I recall they brought Terragen camera tracking data into A:M. I've not been able to find the info on who did it as of yet. Lazlo, Terragen can create the images you describe. Quote
brainmuffin Posted May 18, 2005 Posted May 18, 2005 Same map, applied as a displacement map to a flat grid. The only drawback to this method is that It's completely flat until you render it. Quote
Admin Rodney Posted May 18, 2005 Admin Posted May 18, 2005 Same map, applied as a displacement map to a flat grid. The only drawback to this method is that It's completely flat until you render it. There is another side to displacement maps in A:M that people don't often talk about. You can distort actual geometry via displacement map in A:M. You should be prepared to be patient though as it will take a long time to displace the high density mesh that would be required for that level of detail. If you haven't tried it I suggest using a lower density mesh until you get a feel for the settings you'll need (especially magnitude). It's been awhile since I've done it myself but will be glad to post the step-by-step once I refresh my memory. Rodney Quote
JohnArtbox Posted May 18, 2005 Posted May 18, 2005 Hi Aaver Only just got my ADSL working again but this is a great idea. on the image front erosion through exfoliation and entrainment would work well. Also variable resolution options so you could concentrate detail in the foreground. As has been mentioned texturing is an issue. On the pc front Darktree works.. but a native combiner would be great. A method for placing hair ecosystems would be cool (height & slope based). Flocking that works for simple models eg load 5 trees to mix into a flock forest or 6 houses for a village. Quote
toonnation Posted May 22, 2005 Posted May 22, 2005 the last time i looked there was no way to get normal information, and hence 'slope' in a combiner plugin. which is why i didn't do it in the first place. i'll happily give the terrain wizard code to anyone who wants to use it as a starting point for improvements. i just haven't the time at the moment. regards Andy http://www.toonnation.co.uk Quote
KenH Posted May 22, 2005 Posted May 22, 2005 i'll happily give the terrain wizard code to anyone who wants to use it as a starting point for improvements. i just haven't the time at the moment. regards Andy http://www.toonnation.co.uk Oh! That's a decent offer if ever I heard one! I think Aaver will agree... Quote
brainmuffin Posted May 24, 2005 Posted May 24, 2005 Having given some more playtime to the landscaper , I think that an upgrade to it should do nicely. Mainly, a few more noise types, if possible, and individual scaling options for the two noise functions being blended, as well as some blend zone options. It still would be good to have a combiner, though, so you could blend say, a glowing material with a non-glowing one, but I realize I shouldn't hold my breath on that one. (I should probably save up for DarkTree, huh?) Quote
Paul Forwood Posted May 24, 2005 Posted May 24, 2005 What I would like to see is a realtime fractal map generator which would create a displacement map and a bump map which would then be applied to a patch grid to create the contours. Fractals are great for simulating the dendrite-like fingers of rock and the fisures created by thousands of years of errosion. I imagine a window containing a top view and a 3D birdseye view of the mesh and some sliders to set various parameters and perhaps a drop-down menu with a selection of pre-made terrains. I think that this would be the first step. Next a colour map generator could be added or the user could use the displacement map as a guide to painting one. If that all goes to plan then you could look at the possibility of adding vegetation. It has been a very long time since I did any coding but I am almost tempted to have a go at this myself. It would take me too long to get up the steam though so I will happily leave it to the likes of Anders and Emilio. Quote
Sharky Posted May 27, 2005 Posted May 27, 2005 Hi Guys! How can I do download the new terrain wizard,that includes materials option? Cheers, Sharky Quote
Srmjr Posted June 11, 2005 Posted June 11, 2005 Yeah, where do I download it? Seriously, Anders, a new terrain wizard would be GREAT! You make it, I'd buy it. (at a reasonable price, of course. ) Sterling Quote
ddustin Posted November 12, 2005 Posted November 12, 2005 Any new news on the terrain generator? David Quote
iGeek Posted November 14, 2005 Posted November 14, 2005 Wow, this sounds like a neat idea. The old terrain plugin is long in need of repair/replacement. I've had two projects recently where I would have been able to use a terrain plugin. One was a model of K2. I had to get someone else to map my terrain map onto a plane for me because the terrain plugin doesn't work on the Mac. The second you can find here. So here's my request for the plugin: add an easy way to create tunnels like in my WIP. I was going to use my old K2 model, but it's really high res and I'm not terribly interested in either cutting a hole in it or using booleans. Good luck with the plugin! -Zev Quote
Mr. Jaqe Posted November 16, 2005 Posted November 16, 2005 Aaver, I think the whole "terrain wizard" idea is awesome! Keep ut the thinking! Quote
mtpeak2 Posted June 26, 2006 Posted June 26, 2006 Aaver, are you still working on this? I would like to see an alternative to the standalone "Terraform". Quote
aaver Posted June 26, 2006 Author Posted June 26, 2006 Aaver, are you still working on this? I would like to see an alternative to the standalone "Terraform". I'm still working on this as in thinking about it, but it isn'ta high priority anymore. Why would you like to see an alternative to the standalone "Terraform"? Maybe you could convince me to continue with this idea. Programming a simple plugin that just generates a patch model from a height map takes maybe a day or two so if that would make you happier, I'd consider it Quote
ericsh6 Posted June 26, 2006 Posted June 26, 2006 I'm still working on this as in thinking about it, but it isn'ta high priority anymore. Aaver, Do you happen to have any source code that extracts the greyscale RGB value from a decal at a CP location? I am making a large mountain terrain with rugged cliffs and geological formations. I use 5 point patches and hooks to put lots of patches where the details are high and transition out to large patches to save on model size. I want to apply a heightmap decal to the finished 2D mesh or maybe even use a rotoscope and alter the altitude of the CPs with the greyscale values. I apologize for putting this request on several threads of this form but I am anxious to complete this plugin so I can finish my mountain range in time. Quote
mtpeak2 Posted June 26, 2006 Posted June 26, 2006 Well I probably won't tell you enough to convince you, but first thing is that I'd rather use the wizard/plug-in so I'm working right in A:M. I wouldn't have to save the model before seeing it in A:M. I would like to see your ocean plug-in incorporated into it (was that ever finished?), the rock generator sounded like a good idea (randomly placed rocks/boulders with adjustment for random sizes, irregularity, clumped together or not, quantity), and possibly a cloud generator, if possible. Also, auto groups for the various things added. If not, that's ok too, but I would like to see your ocean plug-in finished, if it wasn't. And if it was, where can I find it. Quote
aaver Posted June 26, 2006 Author Posted June 26, 2006 Well I probably won't tell you enough to convince you, but first thing is that I'd rather use the wizard/plug-in so I'm working right in A:M. I wouldn't have to save the model before seeing it in A:M. I would like to see your ocean plug-in incorporated into it (was that ever finished?), the rock generator sounded like a good idea (randomly placed rocks/boulders with adjustment for random sizes, irregularity, clumped together or not, quantity), and possibly a cloud generator, if possible. Also, auto groups for the various things added. If not, that's ok too, but I would like to see your ocean plug-in finished, if it wasn't. And if it was, where can I find it. So a simple plugin that just generates a patch model from a height map won't make you happy then? I think I'll start with that anyway and after that, I'll give the complete terrain wizard another thought. The ocean plugin isn't available. It's not that difficult to program though and I have an almost working version for A:M v11, but when the SDK changed for v12 it wasn't possible anymore (or maybe I just don't understand how to). In the v13 SDK, I think it's possible again, but I don't have access to A:M v13 which makes development virtually impossible. Maybe I'll finish the v11 version, but since it won't run under A:M v12 & v13 I'm not sure really. Eventually there will be an Ocean plugin available. I'm not able to tell you when, though... Quote
aaver Posted June 27, 2006 Author Posted June 27, 2006 I'm still working on this as in thinking about it, but it isn'ta high priority anymore. Aaver, Do you happen to have any source code that extracts the greyscale RGB value from a decal at a CP location? I am making a large mountain terrain with rugged cliffs and geological formations. I use 5 point patches and hooks to put lots of patches where the details are high and transition out to large patches to save on model size. I want to apply a heightmap decal to the finished 2D mesh or maybe even use a rotoscope and alter the altitude of the CPs with the greyscale values. I apologize for putting this request on several threads of this form but I am anxious to complete this plugin so I can finish my mountain range in time. I'm sorry, but I can't give you any advice off-hand to solve this. However, this pseudo code might be helpful: Vector2 uvs[15]; HClipProperty *hcp = hd->GetChildDecalClipContainer()->GetChildDecalClip()->GetClip(); HDecalStamp *hds = hd->GetChildDecalStampContainer()->GetChildDecalStamp(); for ( HBasePatchUV *hbpuv = hds->GetFirstPatchUV(); hbpuv; hbpuv = hds->GetNextPatchUV( hbpuv ) ) { hbpuv->GetUVs( uvs ); if ( hbpuv->IsPatch5UV() ) { // hbpuv[0], hbpuv[3], hbpuv[6], hbpuv[9] and hbpuv[12] now holds the UVs for the 5 point patch } else { // hbpuv[0], hbpuv[3], hbpuv[6] and hbpuv[9] now holds the UVs for the 4 point patch } HPatch *hp = hbpuv->GetPatch(); //hp now holds a reference to the actual patch. // With hcp->ReadBitmap( float x, float y, RGBFloat *diffuse, float *opacity, float pixelwidth ) // you may now read the color values from the decal for a particular UV coordinate and then // adjust the height for the Patch CPs accordingly } Quote
mtpeak2 Posted June 27, 2006 Posted June 27, 2006 I'm glad to see the ocean plug-in is still on the horizon. Well, if all I can get is a simple height map plug-in, I guess that will have to do. Quote
ericsh6 Posted June 27, 2006 Posted June 27, 2006 However, this pseudo code might be helpful: Thankyou, thankyou. I am now studying this code. Quote
ericsh6 Posted June 27, 2006 Posted June 27, 2006 Aavers, In this line of code: HClipProperty *hcp = hd->GetChildDecalClipContainer()->GetChildDecalClip()->GetClip(); Do you get *hd from HModelCache *hmc ? Is *hd an instance of HDecal? Quote
ericsh6 Posted June 27, 2006 Posted June 27, 2006 Is this right? HDecal *hd = hmc->GetChildDecalContainer()->GetChildDecal(); Wow, I am realizing as I study your code Aavers, that you gave me the entire solution. So far it appears to be supported in V13 SDK. Quote
aaver Posted June 27, 2006 Author Posted June 27, 2006 Is this right? HDecal *hd = hmc->GetChildDecalContainer()->GetChildDecal(); Yes it is, but maybe you should consider calling the plugin directly from the HDecal. That way you won't have to decide which decal to base the displacements from, should there be more than one. You can of course decide to pick the right one from a drop down list. It's a matter of taste, I guess.Wow, I am realizing as I study your code Aavers, that you gave me the entire solution. So far it appears to be supported in V13 SDK.If that's the case, I'm happy to be able to help Quote
ericsh6 Posted June 27, 2006 Posted June 27, 2006 maybe you should consider calling the plugin directly from the HDecal. You mean like right clicking on the decal and seeing a plugin option there? How do I get the plugin option to show up there? In my Entry.cpp file I have: extern "C" __declspec(dllexport) BOOL HxtOnCommand(TreeObject, UINT index) { switch(index) { case MODEL: bla bla bla case OBJECTCONTAINER: bla bla lba } return FALSE; ) Is this the member funtion that generates the "plugin" option when you right click on the model or decal or coreography? Also, once I get the cp with this code: HPatch *hp = hbpuv->GetPatch(); HCP *cp = hp->GetCP1(); Vector *pos = cp->getPosition(); ???? how do I alter or modify the z coordinate of pos before calling setPosition in the next step ???? cp->SetPosition(pos) How do you set Quote
ericsh6 Posted June 27, 2006 Posted June 27, 2006 Aavers, Here is the code I plan to use. I changed the code to dark green that had compile errors: cannot convert from 'const class Vector *' to 'class Vector *' cannot convert parameter 3 from 'class RGBF1 **' to 'class RGBFloat *' Am I using Vector correctly? BOOL CSampleApp::meshDeform(HModelCache *hmc) { Vector2 *uvs, *repeat; RGBFloat *heightValue; float *opacity; Vector *pos; HPatch5 *fivePoint; HDecal *hd = hmc->GetChildDecalContainer()->GetChildDecal(); HClipProperty *hcp = hd->GetChildDecalClipContainer()->GetChildDecalClip()->GetClip(); HDecalStamp *hds = hd->GetChildDecalStampContainer()->GetChildDecalStamp(); for ( HBasePatchUV *hbpuv = hds->GetFirstPatchUV(); hbpuv; hbpuv = hds->GetNextPatchUV( hbpuv ) ) { hbpuv->GetUVs( uvs ); pos = hbpuv->GetPatch()->GetCP1()->GetPosition(); hcp->GetClip()->ReadBitmap(uvs[0][0], uvs[0][1], &heightValue, &opacity, 1, 0, &repeat, FALSE); pos[2] = pos[2] + heightValue->Red(); hbpuv->GetPatch()->GetCP1()->SetPosition(pos); pos = hbpuv->GetPatch()->GetCP2()->GetPosition(); hcp->GetClip()->ReadBitmap(uvs[3][0], uvs[3][1], &heightValue, &opacity, 1, 0, &repeat, FALSE); pos[2] = pos[2] + heightValue->Red(); hbpuv->GetPatch()->GetCP1()->SetPosition(pos); pos = hbpuv->GetPatch()->GetCP3()->GetPosition(); hcp->GetClip()->ReadBitmap(uvs[6][0], uvs[6][1], &heightValue, &opacity, 1, 0, &repeat, FALSE); pos[2] = pos[2] + heightValue->Red(); hbpuv->GetPatch()->GetCP1()->SetPosition(pos); pos = hbpuv->GetPatch()->GetCP4()->GetPosition(); hcp->GetClip()->ReadBitmap(uvs[9][0], uvs[9][1], &heightValue, &opacity, 1, 0, &repeat, FALSE); pos[2] = pos[2] + heightValue->Red(); hbpuv->GetPatch()->GetCP1()->SetPosition(pos); if ( hbpuv->IsPatch5UV() ) { fivePoint = hbpuv->GetPatch(); pos = fivePoint->GetCP5()->getPosition(); hcp->GetClip()->ReadBitmap(uvs[12][0], uvs[12][1], &heightValue, &opacity, 1, 0, &repeat, FALSE); pos[2] = pos[2] + heightValue->Red(); hbpuv->GetPatch()->GetCP1()->SetPosition(pos); } } } Quote
aaver Posted June 27, 2006 Author Posted June 27, 2006 maybe you should consider calling the plugin directly from the HDecal. You mean like right clicking on the decal and seeing a plugin option there? How do I get the plugin option to show up there? In my Entry.cpp file I have: extern "C" __declspec(dllexport) BOOL HxtOnCommand(TreeObject, UINT index) { switch(index) { case MODEL: bla bla bla case OBJECTCONTAINER: bla bla lba } return FALSE; ) Is this the member funtion that generates the "plugin" option when you right click on the model or decal or coreography? To call your plugin from a HDecal, try this enum { DECAL }; extern "C" __declspec(dllexport) const BOOL HxtLoadCommandEntry(UINT index, ObjectType &objtype) { switch (index) { case DECAL: objtype = HOT_DECAL; return TRUE; } return FALSE; } Also, once I get the cp with this code: HPatch *hp = hbpuv->GetPatch(); HCP *cp = hp->GetCP1(); Vector *pos = cp->getPosition(); ???? how do I alter or modify the z coordinate of pos before calling setPosition in the next step ???? cp->SetPosition(pos) How do you set Try this: HCP *cp = hp->GetCP1(); Vector pos = *cp->GetPosition(); pos += Vector( 0.0f, 0.0f, 10.0f ); // or what ever... cp->SetPosition( &pos ); Quote
ericsh6 Posted June 27, 2006 Posted June 27, 2006 OK, this is getting good now. The plugin folder appears when I right click on the decal and my plugin is there in the wizzards folder. My dialog box comes up, I press OK and the member function below gets called. The mesh is deformed but not as I expect. The plugin is displacing the CPs on the perimeter of the mesh only. Also, what is the proper syntax of this line? fivePoint = hbpuv->GetPatch(); BOOL CSampleApp::DeformMesh(HDecal *hd) { Vector2 uvs[15]; RGBFloat heightValue; float opacity; Vector pos; //HPatch5 *fivePoint; HCP *cp; //HDecal *hd = hmc->GetChildDecalContainer()->GetChildDecal(); HClipProperty *hcp = hd->GetChildDecalClipContainer()->GetChildDecalClip()->GetClip(); HDecalStamp *hds = hd->GetChildDecalStampContainer()->GetChildDecalStamp(); for ( HBasePatchUV *hbpuv = hds->GetFirstPatchUV(); hbpuv; hbpuv = hds->GetNextPatchUV( hbpuv ) ) { hbpuv->GetUVs( uvs ); cp = hbpuv->GetPatch()->GetCP1(); pos = *cp->GetPosition(); hcp->ReadBitmap(uvs[0][0], uvs[0][1], &heightValue, &opacity, 1); pos += Vector(0.0f, 0.0f, heightValue.Red()); cp->SetPosition( &pos ); cp = hbpuv->GetPatch()->GetCP2(); pos = *cp->GetPosition(); hcp->ReadBitmap(uvs[3][0], uvs[3][1], &heightValue, &opacity, 1); pos += Vector(0.0f, 0.0f, heightValue.Red()); cp->SetPosition( &pos ); cp = hbpuv->GetPatch()->GetCP3(); pos = *cp->GetPosition(); hcp->ReadBitmap(uvs[6][0], uvs[6][1], &heightValue, &opacity, 1); pos += Vector(0.0f, 0.0f, heightValue.Red()); cp->SetPosition( &pos ); cp = hbpuv->GetPatch()->GetCP4(); pos = *cp->GetPosition(); hcp->ReadBitmap(uvs[9][0], uvs[9][1], &heightValue, &opacity, 1); pos += Vector(0.0f, 0.0f, heightValue.Red()); cp->SetPosition( &pos ); if ( hbpuv->IsPatch5UV() ) { /* fivePoint = hbpuv->GetPatch(); pos = fivePoint->GetCP5()->getPosition(); hcp->GetClip()->ReadBitmap(uvs[12][0], uvs[12][1], &heightValue, &opacity, 1, 0, &repeat, FALSE); pos[2] = pos[2] + heightValue->Red(); hbpuv->GetPatch()->GetCP1()->SetPosition(pos);*/ } } return TRUE; } Quote
ddustin Posted June 27, 2006 Posted June 27, 2006 How is this different from the Terra-form plugin? Quote
ericsh6 Posted June 27, 2006 Posted June 27, 2006 Here is a thread that explains what I am trying to do, although I don't think I am explaining it too well. http://www.hash.com/forums/index.php?showt...15entry182776 Hopefully the plugin will be done very soon and we can see better what it can do. Quote
aaver Posted June 27, 2006 Author Posted June 27, 2006 OK, this is getting good now. The plugin folder appears when I right click on the decal and my plugin is there in the wizzards folder. My dialog box comes up, I press OK and the member function below gets called. The mesh is deformed but not as I expect. The plugin is displacing the CPs on the perimeter of the mesh only.[...] You do realize that the HDecal coordinates and the UV coordinates are different, don't you. Try this and I think you will have a working plugin int dWidth = hcp->GetWidth(); int dHeight = hcp->GetHeight(); . . . hcp->ReadBitmap(uvs[0].x*dWidth, uvs[0].y*dHeight, &heightValue, &opacity, 1); Quote
ericsh6 Posted June 28, 2006 Posted June 28, 2006 Aavers, Are you superhuman? I added your correction for decal width and height and just as you said - the plugin works!!! Here are some pictures of how it works: 1) In the first picture I use the height image as a rotoscope and build the mesh to conform to the contours. 2) In the second picture I apply the decal to the mesh. 3) In the third picture I right clicked on the decal and picked the new plugin and it deformed the mesh based on the decal. Quote
luckbat Posted June 28, 2006 Posted June 28, 2006 Well, well, well. This thread just got much more interesting... Quote
ericsh6 Posted June 28, 2006 Posted June 28, 2006 Oh yea, this code still gives me trouble. What is the proper way to type cast this line? HPatch5 *fivePoint = hbpuv->GetPatch(); if ( hbpuv->IsPatch5UV() ) { HPatch5 *fivePoint = hbpuv->GetPatch(); cp = hbpuv->GetPatch()->GetCP5(); pos = *cp->GetPosition(); hcp->ReadBitmap(uvs[12].x*dWidth, uvs[12].y*dHeight, &heightValue, &opacity, 1); pos += Vector(0.0f, 0.0f, heightValue.Red()); cp->SetPosition( &pos ); } Quote
aaver Posted June 28, 2006 Author Posted June 28, 2006 Oh yea, this code still gives me trouble. What is the proper way to type cast this line? HPatch5 *fivePoint = hbpuv->GetPatch(); if ( hbpuv->IsPatch5UV() ) { HPatch5 *fivePoint = hbpuv->GetPatch(); cp = hbpuv->GetPatch()->GetCP5(); pos = *cp->GetPosition(); hcp->ReadBitmap(uvs[12].x*dWidth, uvs[12].y*dHeight, &heightValue, &opacity, 1); pos += Vector(0.0f, 0.0f, heightValue.Red()); cp->SetPosition( &pos ); } Try this if ( hbpuv->IsPatch5UV() ) { HPatch5 *fivePoint =(HPatch5 *)hbpuv->GetPatch(); cp = fivePoint->GetCP5(); pos = *cp->GetPosition(); hcp->ReadBitmap(uvs[12].x*dWidth, uvs[12].y*dHeight, &heightValue, &opacity, 1); pos += Vector(0.0f, 0.0f, heightValue.Red()); cp->SetPosition( &pos ); } Also, you have one more problem to solve before your plugin is ready. You displace most of the CPs more than once. For a grid like this CP1------CP2------CP3 | | | CP4------CP5------CP6 | | | CP7------CP8------CP9 with your code, CP1, CP3, CP7 and CP9 are displaced once, CP2, CP4, CP6 and CP8 are displaced twice and CP5 is displaced four times since it's a member of four different patches. Before you are ready, you have to add some bookkepeing so you displace every CP just once. I think Steffen offered you some code in another thread that may be usefull for that. Quote
ericsh6 Posted June 28, 2006 Posted June 28, 2006 Try this Thanks! Also, you have one more problem to solve before your plugin is ready. You displace most of the CPs more than once. Oh ouch! This is the first thing that comes to my mind: Get a pointer to the HDecalStamp For each patch in the HDecalStamp { For each CP in the patch { search through the CArray to see if the CP has already been added if it hasn't been added then { update it's position with ReadBitmap add the CP to the CArray } } } My concern is that as I add CPs to the CArray, it takes longer and longer to search. If my mountain has over 40,000 patches then this plugin will run for a long time. Quote
ericsh6 Posted June 28, 2006 Posted June 28, 2006 Oh wait, I think I understand Steffen's code now. Quote
ericsh6 Posted June 28, 2006 Posted June 28, 2006 OK, I fixed the repetitive CP problem with Steffen's code. Thanks again Steffen. BOOL CSampleApp::DeformMesh(HDecal *hd) { CArray <_CP,_CP &> cplist; _CP tempcp; Vector2 uvs[15]; RGBFloat heightValue; float opacity; Vector pos; //HPatch5 *fivePoint; HCP *cp; //HDecal *hd = hmc->GetChildDecalContainer()->GetChildDecal(); HClipProperty *hcp = hd->GetChildDecalClipContainer()->GetChildDecalClip()->GetClip(); HDecalStamp *hds = hd->GetChildDecalStampContainer()->GetChildDecalStamp(); int dWidth = hcp->GetWidth(); int dHeight = hcp->GetHeight(); for ( HBasePatchUV *hbpuv = hds->GetFirstPatchUV(); hbpuv; hbpuv = hds->GetNextPatchUV( hbpuv ) ) { hbpuv->GetUVs( uvs ); cp = hbpuv->GetPatch()->GetCP1(); pos = *cp->GetPosition(); hcp->ReadBitmap(uvs[0].x*dWidth, uvs[0].y*dHeight, &heightValue, &opacity, 1); pos += Vector(0.0f, 0.0f, heightValue.Red()); tempcp.pos = pos; tempcp.cp = cp; cplist.Add(tempcp); cp = hbpuv->GetPatch()->GetCP2(); pos = *cp->GetPosition(); hcp->ReadBitmap(uvs[3].x*dWidth, uvs[3].y*dHeight, &heightValue, &opacity, 1); pos += Vector(0.0f, 0.0f, heightValue.Red()); tempcp.pos = pos; tempcp.cp = cp; cplist.Add(tempcp); cp = hbpuv->GetPatch()->GetCP3(); pos = *cp->GetPosition(); hcp->ReadBitmap(uvs[6].x*dWidth, uvs[6].y*dHeight, &heightValue, &opacity, 1); pos += Vector(0.0f, 0.0f, heightValue.Red()); tempcp.pos = pos; tempcp.cp = cp; cplist.Add(tempcp); cp = hbpuv->GetPatch()->GetCP4(); pos = *cp->GetPosition(); hcp->ReadBitmap(uvs[9].x*dWidth, uvs[9].y*dHeight, &heightValue, &opacity, 1); pos += Vector(0.0f, 0.0f, heightValue.Red()); tempcp.pos = pos; tempcp.cp = cp; cplist.Add(tempcp); if ( hbpuv->IsPatch5UV() ) { cp = ((HPatch5 *)hbpuv->GetPatch())->GetCP5(); pos = *cp->GetPosition(); hcp->ReadBitmap(uvs[12].x*dWidth, uvs[12].y*dHeight, &heightValue, &opacity, 1); pos += Vector(0.0f, 0.0f, heightValue.Red()); tempcp.pos = pos; tempcp.cp = cp; cplist.Add(tempcp); } } for (int i=0;i<cplist.GetSize();++i) { pos = cplist[i].pos; cplist[i].cp->SetPosition(&pos); } return TRUE; } Quote
ericsh6 Posted June 28, 2006 Posted June 28, 2006 And now, to satisfy the artist in all of us: Image 1: This is the heightmap I created in paint shop pro. Image 2: I create a new model, GO TO FRONT VIEW (very important) and add a rotoscope of the heightmap and build a spline mesh that hugs its contours. I use a hook and 5 point patches to keep a continuous mesh between the 3 mountains Image3: I turn off the rotoscope and apply the heightmap decal to the mesh. I make sure the new decal has the same X and Y origin and X and Y scale as the rotoscope. Image4: I right click on the decal and choose the new plugin and press the OK button on the plugin dialog box and presto - we have mountains!!! Notes: Now I really want to use this on satellite images of real mountains and I am going to do that next unless anyone sees a flaw with the code. Steffen's splitpatch plugin can be used to refine the mesh anywhere on the mountain needed. The mesh has to be built in the front view because I deform the Z coordinates. Quote
Zaryin Posted June 28, 2006 Posted June 28, 2006 Wow, this is great. I like it because you can paint basic moutain shapes, then use a displacement map to add even more detail. Nice. Quote
aaver Posted June 28, 2006 Author Posted June 28, 2006 OK, I fixed the repetitive CP problem with Steffen's code. Thanks again Steffen. You still have one bug left that is hard to find. When you change a CP you should change the Head CP of the CP stack. Since your code changes most stacks several times, it will probably take a while before you experience this bug. To fix the bug, always change the Head CP: cp = hbpuv->GetPatch()->GetCP2()->GetHead(); Quote
ericsh6 Posted June 29, 2006 Posted June 29, 2006 To fix the bug, always change the Head CP: Thanks. I am trying to make this plugin available to others. When I run it on another machine than the one I compiled it on I get this message: Unable to load plug-in [F:\Program Files\Hash Inc\V13.0\HXT\decalDeform.hxt], The specified module could not be found. (run on Windows XP home edition service pack 2. AM Version 13.0a.) Is there a guide somewhere on how to productionize a plugin? Do you have to have a Mac to compile the plugin for Mac users? Quote
Developer yoda64 Posted June 29, 2006 Developer Posted June 29, 2006 Sounds like you are using a version compiled for debugging , you must compile in release mode. If it's needed I have a mac :-) Quote
aaver Posted June 29, 2006 Author Posted June 29, 2006 To fix the bug, always change the Head CP: Thanks. I am trying to make this plugin available to others. When I run it on another machine than the one I compiled it on I get this message: Unable to load plug-in [F:\Program Files\Hash Inc\V13.0\HXT\decalDeform.hxt], The specified module could not be found. (run on Windows XP home edition service pack 2. AM Version 13.0a.) Is there a guide somewhere on how to productionize a plugin? Do you have to have a Mac to compile the plugin for Mac users? I'm not familiar with that error message, but I compiled my own version of the plugin. I've attached it so you can test if that one gives you the same error. (Note: In my version, the displacement takes place in the y direction) Steffen knows everything on making plugins for the Mac (and not only for the Mac). Read all his posts on the SDK forum! ImageDisplace.zip Quote
ericsh6 Posted June 29, 2006 Posted June 29, 2006 Sounds like you are using a version compiled for debugging , you must compile in release mode. I see. If it's needed I have a mac So it has to be compiled on a mac, OK. In my version, the displacement takes place in the y direction I changed it to displace in the Y direction too. I am building the 2D mesh from a rotoscope of satallite image right now. It's nice that the plugin runs so fast, it lets me incrementally deform the mesh and see how things are looking. To go back to 2D all I have to do is scale the mesh to 0 in the Y direction. So far so good. Quote
mtpeak2 Posted June 29, 2006 Posted June 29, 2006 I was thinking, this could be good for faces as well. If a height map can be made for a face and use the plug-in, that would be cool. You basicly are modelling the face in the flatten position. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.