Image masking using through camera projection, how to?

Started by Tangled-Universe, December 18, 2007, 03:56:11 PM

Previous topic - Next topic

Tangled-Universe

Hello everybody,

During my last weeks working on my strata image I was trying to use image masking in order to distribute large fake stones on exact places I'd like them to be.
I've been trying to do this using through camera projection by first rendering the image (in low quality) and secondly to paint the mask in a new layer on top of the image.
Saving it as a black and white mask and import it in TG2.

I've made an example to illustrate my problem and my desired technique.

This is a butt-ugly example terrain on which I, for example purpose, painted the desired distribution in white:


Which results in the following b&w mask:


I'd like to have this b&w projected through my camera on the terrain so I'll get the exact distribution on the terrain as I've painted.
The result:



For this example it surprisingly seems to work, but for my strata-project it isn't working at all. Even worse, If I apply an image mask and want to repopulate the program crashes :(
As you can see the stones do not exactly follow my mask and also some areas don't show up at all.

I'm having extreme difficulties understandig how to manipulate the settings to match the mask with the image.
I've attached a tgd file to show my setup.
What am I doing wrong? Or is there another way to achieve this?
Thanks in advance for your time guys, hope you van help me out.

Martin

moodflow

There "may" be a problem with the camera projection option, as I've had similar issues.  Everything worked when I masked it via Plan Y, but when done through camera projection, it didn't seem to work.  I haven't had time to test this again though.  In my case, it was more of a projection of an image onto terrain via a mask.

http://www.moodflow.com
mood-inspiring images and music

dhavalmistry

using Plan Y might not help at all.....because I think the mask will stretch itself on the slopes to fit properly....although I think it can be fixed using a known resolution TER (for example 4096 x 4096) and also making the mask the same size as the TER (4096 x 4096)
"His blood-terragen level is 99.99%...he is definitely drunk on Terragen!"

Oshyan

Make sure the size of the image and number of tiles are all correct. I think they should basically all be 1. You can attach your mask to a surface layer to make sure it is projecting correctly. If it is, then it may be some problem with the distribution input/control of Fake Stones or Strata, although we're not aware of such problems at this time.

- Oshyan

bigben

Actually, if you look at the sample images above you'll find it hasn't worked. The distribution is off at the bottom of the image. I found this too when using a through camera mask although it's something I normally avoid doing. 

Rather than going through the effort of  exporting the terrain I first create a rectangular mask to define the area of interest and then make a surface so that everything outside of this rectangle is white.  Move the camera way up, looking directly down, small fov etc... and render the terrain. Open the render, crop to the edge of the masked terrain and then start drawing a mask in a new layer.  Load the new mask with Plan Y using the parameters used to create the first mask.  If you use a white bitmap for the first mask then all you have to do is change the filename and rearrange the node connection.

JimB

Oshyan, is the projection through camera implicit or explicit? If explicit, the twist and shear, and any other displacement, might be carrying the projection with it, which might give an unexpected result.
Some bits and bobs
The Galileo Fallacy, 'Argumentum ad Galileus':
"They laughed at Galileo. They're laughing at me. Therefore I am the next Galileo."

Nope. Galileo was right for the simpler reason that he was right.

Tangled-Universe

Thank you for your responses so far everybody.

Quote from: Oshyan on December 19, 2007, 03:28:05 AM
Make sure the size of the image and number of tiles are all correct. I think they should basically all be 1. You can attach your mask to a surface layer to make sure it is projecting correctly. If it is, then it may be some problem with the distribution input/control of Fake Stones or Strata, although we're not aware of such problems at this time.

- Oshyan

The image size of the mask is the same size as the target render size, tiling is 1x1, no flips/repeats. In the small preview-window of the node the mask seems to appear correctly.

Quote from: bigben on December 19, 2007, 10:26:15 PM
Actually, if you look at the sample images above you'll find it hasn't worked. The distribution is off at the bottom of the image. I found this too when using a through camera mask although it's something I normally avoid doing. 

Rather than going through the effort of  exporting the terrain I first create a rectangular mask to define the area of interest and then make a surface so that everything outside of this rectangle is white.  Move the camera way up, looking directly down, small fov etc... and render the terrain. Open the render, crop to the edge of the masked terrain and then start drawing a mask in a new layer.  Load the new mask with Plan Y using the parameters used to create the first mask.  If you use a white bitmap for the first mask then all you have to do is change the filename and rearrange the node connection.

Yes I also mentioned in my post that the mask did not work 100% correctly.
Honestly, I don't understand the workflow you've explained at all.
Could you explain a little bit more 'graphic' what you mean? :)
I know you're the master of masks here on the forum ;)

Quote from: JimB on December 20, 2007, 06:58:29 AM
Oshyan, is the projection through camera implicit or explicit? If explicit, the twist and shear, and any other displacement, might be carrying the projection with it, which might give an unexpected result.

Very interesting point you make here, hope someone of planetside can tell us something about this (all).


Tangled-Universe

Ok guys, I'm figurely almost crying of pure frustration and anger.
I'm desperately trying to apply a WM-generated flowmap to my WM-generated terrain so I can use it as a mask for surfacing the terrain.
I've tried everything which came in my mind but I can't get it to work at all  :'( (camera projection, Plan Y, the most insane imagesizes, everything)

Below here is a link to a zip containing one of my terrains and corresponding flowmap.

http://www.sendspace.com/file/syuhc1 (if error shows up then just click 'download link'...did work fine)

Could someone please make a example-tgd for me showing how to apply the flowmap 1:1 on the terrain?
It would be of great help and really appreciated, please save my sanity ;D ;)
Thanks in advance.

Martin

mhaze

This isn't quite right but its very close

Mick

Oshyan

One thing to remember about through camera projection is that it doesn't fit the image to the render size, so if your image is square but your render dimensions are rectangular (normal 4:3 aspect, for example 800x600), then the mask will be off. That's why for front projection you should almost always base your mask directly on a render of the scene, or at least make sure you use the same size (or a multple of it).

For use of a flow mask you want to use PlanY projection. Find out the size of your World Machine terrain in meters (World Machine will tell you), then set the size to that value in the Image Map shader. Set the origin point and position to the same as your Heightfield Loader. That should work.

- Oshyan

Tangled-Universe

Hi Guys,

I'm still having problems with this topic.
Especially one thing:

It seems to be completely impossible to use a b/w image loaded into the imagemap shader as a blendshader for masking populations or strata-outcrops shaders for example.
It doesn't work directly (imagemapshader fed into breakup-input) nor indirectly (imagemapshader fed into color-input of surfacelayer, then connect that surfacelayer into the breakup-input of a parent surface layer).
Whenever I try these things the program inmediately freezes :(

The dimensions of the imagemask are exactly the same as my target rendersize so it really fits the projection.

I hope someone can help (again)?
Thanks in advance.

Martin

moodflow

http://www.moodflow.com
mood-inspiring images and music

bigben

Here's an explanation of my technique for generating an in situ mask (starts at this post, then read on...).
http://forums.planetside.co.uk/index.php?topic=2656.msg27375#msg27375


Tangled-Universe

Hi Ben,

Thanks for your input, I'm already familiar with that topic. It's something I dig up from time to time when I want to use top-down mask-projections.

This is exactly the point here: your technique works fine for plan Y projections, since I use the exact same technique, only difference is I want to use project through camera.
I'd say: try yourself ;)

It really doesn't work :(

bigben

I have... it didn't.  If you're trying to use through the camera for a specific reason (e.g. masking an area under an overhang you might need to combine plany Y with some other functional mask to restrict altitude... but this may be too awkward if you have lots of overhangs to mask.