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:
(http://img233.imageshack.us/img233/8662/maskexample3od0.jpg)
Which results in the following b&w mask:
(http://img215.imageshack.us/img215/6987/maskexample2eo7.jpg)
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:
(http://img513.imageshack.us/img513/5506/maskexampleresultpg4.jpg)
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
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.
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)
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
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.
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.
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).
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 (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
This isn't quite right but its very close
Mick
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
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
I second this, as I use the same technique.
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 (http://forums.planetside.co.uk/index.php?topic=2656.msg27375#msg27375)
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 :(
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.
Yes that exactly one of the reasons why I want to use through camera projection, besides that it is way more convenient when you're able to literally point where you want your effect to be in your current pov. If it works of course :P
Unfortunately my knowledge of functions and how to use them is very limited. I know their capabilities and I can't think of a method to achieve the same result I'm looking for, because I want to mask VERY specific (though large) areas.
In my opinion I think this is a kind of a bug, since the through camera projection doesn't work properly?
Haven't tested this with the new version but I have a quick test in mind which should provide a more accurate representation of the problem
OK... my 2c worth on the problem (ie. I could be wrong). Whenever you mention image projections I think back on stitching panoramas, and a possible cause struck me while walking to work. It may be possible that recilinear distortion used in the render calculation is not being matched by remapping the imagemap to match the camera's fov. This would cause alignment errors which would get worse as you move away from the centre of the image (which appears to be the case).
My test that I mentioned in my previous post was performed without this in mind, but it does match the expected behaviour. The attached image shows the difference between a tiled grid image using plan Y and the render of this applied as a TTL image. The errors are radial in nature and get larger as you get closer to the edges. Lines passing through the centre of the image won't be affected much.
The zip file contains the two TGDs and source images.
Have to work now, but if anyone wants to check this further, the problem should be exacerbated by using a wider fov (try 120° - 140°) and should be negligible at narrower fovs (try 5°). Increase the foc on the first TGD, render it and apply the output to the second TGD. (I had to convert the output image to greyscale and resave in Photoshop because TG didn't like the raw output TIFF)
If I'm right, then this is a problem that would make through the lens projection unusable for very accurate masking, but it should also provide a clue for a fix. I'll investigate this later and see if I can confirm this is the case and whether it is possible to do a pre-render remapping of the image map to counter the problem as an interim measure.
[edit] A possible solution to try may be to treat the original image map to be used with through the lens projection as an equirectangular image with the same FOV as the render camera and remap it to a rectilinear image with the same dimensions as the source image. I'll try this later tonight. If it works it should be a relatively simple workaround [/edit]
T-U,
Can you upload a .tgd that shows how you're trying to connect your shaders? If masking works with Y projection but fails when you try camera projection, there may be a bug that only appears in particular circumstances.
Matt
Quote from: Matt on May 06, 2008, 10:14:35 AM
T-U,
Can you upload a .tgd that shows how you're trying to connect your shaders? If masking works with Y projection but fails when you try camera projection, there may be a bug that only appears in particular circumstances.
Matt
Thank you Matt.
I'm currently at work so I'll upload an example within about 4 hours.
Like I said my suspicion is a bug since using an image mask only for coloring surfaces works fine but when you plug it into a blendshader for populations or strata it freezes.
Unless I'm doing it the wrong way, I'll show you that within a few hours :)
@ BB
Thanks a lot for your time and effort on thinking about a solution for this.
I'll read your suggestions at home because I'm at work now and it seems a bit complicated at first glance.
Martin
Hi Matt,
Here it is: just connect surface layer 01 to the planetshader and you'll see the program crashes.
When you connect surfacelayer 03 ('indirect' method)to the planetshader the program also crashes, but when you connect surfacelayer 02 to the planetshader the color of the mask is projected correctly.
I hope you can figure it out.
Thanks in advance!
Martin
Seconds after posting the zip-file I tried saving the mask as a lzw-compressed tiff-file and that seems to work with both methods....BUT...
...when finishing the preview render after 3 seconds the program still crashes after about 10 seconds. The memory and CPU-usage do not spike. CPU @ 2% and RAM @ ~80 MB.
I've attached the lzw-compressed tiff-file as a zip, since it isn't accepted by the board.
Martin
Ran a couple more tests and my thoughts on image projection appear to be wrong. My last test worked properly, although some of the settings I used in the image node were different to what I normally use. Investigating the other settings to see if I can make it not work now .... ??? ;)
Red grid lines in image below are from a plan Y imagemap. Green "lines" are using a rendered version as a through the lens image map applied as a fractal breakup for a shader. Details in the foreground corners line up correctly
[edit] Extra settings didn't make any difference apart from a very slight offset of the image which was expected. Trying a TGD with more severe displacements (including an overhang... an old Volker classic)[/edit]
I was thinking there was a fairly detailed and insightful discussion of this a while back and was looking for it to see if it had any clues, but then I realized it's just earlier in *this* thread. :P Ben, I presume you're using mask images that are exactly the same dimensions (or at least same aspect ratio) as the render, as per earlier discussion in this thread?
Tangled-Universe, if you're experiencing consistent crashing that's a different thing than what Ben is looking at I think. Does your crash happen with only one image type or have you tried multiple options (jpg, png, etc.)?
- Oshyan
The renders I'm doing at the moment to test this are the using masks that are the same size as the render. I had planned to increase the size of the mask image to see if resizing played any part.
I had experienced similar misalignment issues like the first examples in this thread but I've since been using planY instead as a workaround and didn't have any examples left. The good thing I guess is that so far it's working. ;) I'll have a look at Martin's original example here next and see if that presents a problem.
Just to keep the discussion mixed... on the image loading problems... the first test I tried involved taking the render and using it "raw" as an image map but TG didn't like it, which I thought was odd. After I resaved in Photoshop it behaved nicely, but I suspect the sequence of events may have been similar to those in http://forums.planetside.co.uk/index.php?topic=3929.msg41671#msg41671 (http://forums.planetside.co.uk/index.php?topic=3929.msg41671#msg41671). As this was the first time I'd seen this I put it down to a problem with the image file.
Swapping computers to get this morning's render.... ;)
OK it's still working. This image shows one of Volker's TGDs which was rendered first and a mask drawn over the render. The mask was then used to create a cyan surface layer and rendered. The original mask is overlayed in red in the image. There is a slight offset but this is probably a result of the image smoothing routines. To compensate for this you could move your mask image up and left by 1 pixel when you're finished, but this is not the problem described at the start of this thread. If you turn off image smoothing it's more accurate, but then it's not smooth ;)
Great! Could you post the tgd and imagemasks here please? I'd like to take a look.
What's the difference from my method? Or better: did you use your previously described method or mine?
Martin
No need... I went back to your original files to compare them with my tests. The solution is quite simple, and thinking back... was the cause of my problems as well.
Disconnect the render camera from the image map... problem solved! ;D
With no camera specified it uses the render camera anyway.
I finished up making a new mask from a render of your TGD to get an idea of how it was going wrong. It appeared to be being stretched vertically. Screengrab below shows your mask stretched to fit the rendered result with the render camera attached to the image map. It's stretched about 135% from the centre.
Ben, are you saying that it crashes when a camera is attached to the Image Map Shader?
- Oshyan
No crashing, just a misalignment.
When the render camera is attached the image is stretched vertically. I'll have a play tonight with different render proportions, but looking at this example in isolation it may be that the image width is set to the width of the render, and the height is made the same as the width.
Width:Height here = 1.33 and mask image stretched by 133% to match rendered output
I had a very quick play this morning and I'm not necessarily confident that this is necessarily what is going on, but the behaviour is definitely consistent so there is some form of problem with connecting the camera and Through camera projection.
To explain the screengrab a little more, the bottom layer is the rendered TGD with large fake stones (bright white spots) masked by the mask image (camera attached to image map). I then overlayed the mask image with an opacity of 50% and stretched it to match the fake stones. The handles show the extent of the mask image resizing.
Ah, ok. I think T-A was experiencing crashing though. That was my main concern. Your continued troubleshooting of this is much appreciated. If you can pin down what appears to be going wrong we can surely fix it.
- Oshyan
Quote from: Oshyan on May 08, 2008, 12:18:32 AM
Ah, ok. I think T-A was experiencing crashing though. That was my main concern. Your continued troubleshooting of this is much appreciated. If you can pin down what appears to be going wrong we can surely fix it.
- Oshyan
Yes that's very much appreciated by me also Ben :)
I've posted an example tgd showing my workflow for masking and if I'm correct I didn't specify a projection camera in the imagemap-shaders.
Oshyan is right, I'm experiencing crashes, especially when using camera projection for masking populations or strata shaders.
With bmp's it's crashing inmediately, with tiff after a while (unstable result).
Unfortunately I haven't found the time to test different image-types besides bmp and tiff.
I'll post my findings about that a.s.a.p.
Thank you both!
Martin
The last time I checked, TG would crash when rendering an image map shader when projection through camera was active but no cam specified. That was with TP2 though.
From my experience, the image map shader works quite well - as long as you keep in mind that it projects a squared image with the dimensions max(horizontal fov, vertical fov)² as Oshyan explained on page one and bigben just noticed again.
If you have a render in a 4:3 format, and the mask is squared (dimensions are 1;1 in the image map shader, I think those values override the aspect ratio of the image(!)), it will indeed be 133% higher than needed.
Sorry in case I'm only telling you stuff you already knew all along. :)
I suspected it would be square. Changing the proportions of the mask image has no effect. I can stop those tests.
As for crashes... I have used through camera projection for restricting populations without crashing before although the image was usually just a small white TIFF. I use greyscale TIFFs with LZW compression. I'll have a look at Martin's last set of files... a challenge for the train tomorrow morning ;)
OK, had a quick play and yes it crashes on preview.
Converted to TIF and it still crashes.
Reconstructed a similar scene and it doesn't crash!
This is using the alpha version. If you want a file in the previous version just let me know. Looking at your TGD I couldn't really see anything that should cause a crash. Method 1 is one of the standard masks I use (apart from Through camera projection). I don't think it has anything to do with the surface/mask nodes, nor the file format of the image... possibly some other render setting? I'll have a closer look at the code in the morning.
Quote from: bigben on May 08, 2008, 08:08:35 AM
OK, had a quick play and yes it crashes on preview.
Converted to TIF and it still crashes.
Reconstructed a similar scene and it doesn't crash!
This is using the alpha version. If you want a file in the previous version just let me know. Looking at your TGD I couldn't really see anything that should cause a crash. Method 1 is one of the standard masks I use (apart from Through camera projection). I don't think it has anything to do with the surface/mask nodes, nor the file format of the image... possibly some other render setting? I'll have a closer look at the code in the morning.
Thanks a lot Ben. I'll take a look at it when I'm back home... I'm also a registred user so this version shouldn't be a problem :)
To be very precise: using a tiff it crashes on preview, but using a bmp it crashes on connection. That difference gives me the impression it's some kind of a bug and like you said my method (1) is a standard one and there's also nothing out of the normal about my node-setup. It's easy and straight-forward.
It also has nothing to do with something specific in the tgd's I posted here or some rendersetting. It ALWAYS occurs in every scene I set up. No matter how simple, like the examples I posted.
Quote from: nikita on May 08, 2008, 05:53:59 AM
The last time I checked, TG would crash when rendering an image map shader when projection through camera was active but no cam specified. That was with TP2 though.
From my experience, the image map shader works quite well - as long as you keep in mind that it projects a squared image with the dimensions max(horizontal fov, vertical fov)² as Oshyan explained on page one and bigben just noticed again.
If you have a render in a 4:3 format, and the mask is squared (dimensions are 1;1 in the image map shader, I think those values override the aspect ratio of the image(!)), it will indeed be 133% higher than needed.
Sorry in case I'm only telling you stuff you already knew all along. :)
Thank you Nikita :)
To be honest I don't understand why the image-projection is square, why not the same as the rendercamera-setting?
I understand that's not a question for you to answer.
I've read your posts again (Ben, Oshyan and you) and it's still a bit unclear how to setup the image-mask properly if the projection is square.
What aspect ratio/dimensions must the mask be if I want to mask a 800x600 image for example?
Quote from: Tangled-Universe on May 08, 2008, 10:32:29 AM
Thank you Nikita :)
To be honest I don't understand why the image-projection is square, why not the same as the rendercamera-setting?
I understand that's not a question for you to answer.
I've read your posts again (Ben, Oshyan and you) and it's still a bit unclear how to setup the image-mask properly if the projection is square.
What aspect ratio/dimensions must the mask be if I want to mask a 800x600 image for example?
The mage map shader doesn't even know the aspect ratio of the render (remember, it's only connected to the camera node, not the render node). It also ignores the aspect ratio of your image, because the area the image occupies is being set directly in the image map shader. Since the default values for "horizontal" and "vertical" size are 1 and 1, your image is projected on a square area (when projected along an axis, it's 1m x 1m in size).
If your image is 4:3, you can fit it to the field of view by setting size to 1 ; 0.75. (0.75=3/4)
I see what you mean, the math is no problem :P
So in conclusion I'd have to paint a mask then resize it to a square image and then resize it back in TG2 using those factors?
At least, for matching the image with the render.
The crashes still occur, see post below.
Quote from: bigben on May 08, 2008, 08:08:35 AM
OK, had a quick play and yes it crashes on preview.
Converted to TIF and it still crashes.
Reconstructed a similar scene and it doesn't crash!
This is using the alpha version. If you want a file in the previous version just let me know. Looking at your TGD I couldn't really see anything that should cause a crash. Method 1 is one of the standard masks I use (apart from Through camera projection). I don't think it has anything to do with the surface/mask nodes, nor the file format of the image... possibly some other render setting? I'll have a closer look at the code in the morning.
Thanks Ben.
Unfortunately I think you missed something about my point here. Like I explained in my previous post it is no problem using the image to mask a surface layer for color.
The tgd you posted above is only a mask for color.
If you insert a strata and outcrop-shader, connect the imagemap into the blendshader and then activate it it crashes inmediately. But if you connect surfacelayer 01 with the imagemap attached to it it crashes 'just' after a few seconds.
If you insert a population and use surfacelayer 01 with the imagemap attached to it as a density function it doesn't crash inmediately or after a few seconds but it crashes as soon as you hit the populate button.
Please PS, there should be a way to sort this out.
Quote from: Tangled-Universe on May 08, 2008, 01:28:47 PM
Thanks Ben.
Unfortunately I think you missed something about my point here. Like I explained in my previous post it is no problem using the image to mask a surface layer for color.
The tgd you posted above is only a mask for color.
If you insert a strata and outcrop-shader, connect the imagemap into the blendshader and then activate it it crashes inmediately. But if you connect surfacelayer 01 with the imagemap attached to it it crashes 'just' after a few seconds.
If you insert a population and use surfacelayer 01 with the imagemap attached to it as a density function it doesn't crash inmediately or after a few seconds but it crashes as soon as you hit the populate button.
Please PS, there should be a way to sort this out.
But there are none of those nodes in TU-MaskProblem.tgd and it crashes every time when you connect one of your node branches to the planet which is why I think your problem is something more fundamental. If you can't successfully render the mask then nothing you connect it to is going to work.
To explore this further I opened your file and recreated every node prior to the planet in the same TGD, using your BMP as an image. I copied the Base Colours node from one of my other TGDs. This doesn't crash! Connect the surface from Method 1 or 2 and it will crash rendering a preview (usually shortly after the preview render has completed)... every time! There must be a clue somewhere in the code to see what is different between each node.
Quote from: Tangled-Universe on May 08, 2008, 01:08:06 PM
I see what you mean, the math is no problem :P
So in conclusion I'd have to paint a mask then resize it to a square image and then resize it back in TG2 using those factors?
At least, for matching the image with the render.
The crashes still occur, see post below.
I guess the easiest way is to make image, image map size and render size the same aspect ratio. That way the mask should cover exactly what you see.
Quote from: Tangled-Universe on May 08, 2008, 01:08:06 PM
I see what you mean, the math is no problem :P
So in conclusion I'd have to paint a mask then resize it to a square image and then resize it back in TG2 using those factors?
At least, for matching the image with the render.
The crashes still occur, see post below.
Missed this one. In theory, render image, draw mask, set canvas size to height = width (not resize image).
Quote from: bigben on May 08, 2008, 05:05:52 PM
To explore this further I opened your file and recreated every node prior to the planet in the same TGD, using your BMP as an image. I copied the Base Colours node from one of my other TGDs. This doesn't crash! Connect the surface from Method 1 or 2 and it will crash rendering a preview (usually shortly after the preview render has completed)... every time! There must be a clue somewhere in the code to see what is different between each node.
Had a bit more of a play and it's getting into twilight zone territory. I opened up the TGD where I had duplicated method 1 and then gradually connected the nodes from the original Method 1 branch.
Compute terrain -> Base Colour - OK
Base Colour -> Surface 04 - OK
Image map -> Fractal breakup of Surface 04 - OK
That leaves only Surface 01 -> Planet - Crash after preview completes
Copied both nodes to a text file but I can't see anything that is substantially different ???
I've done about all I can to isolate where the problem is but I have no idea of the cause.
Quote from: bigben on May 08, 2008, 06:00:46 PM
Quote from: Tangled-Universe on May 08, 2008, 01:08:06 PM
I see what you mean, the math is no problem :P
So in conclusion I'd have to paint a mask then resize it to a square image and then resize it back in TG2 using those factors?
At least, for matching the image with the render.
The crashes still occur, see post below.
Missed this one. In theory, render image, draw mask, set canvas size to height = width (not resize image).
Quote from: bigben on May 08, 2008, 05:05:52 PM
To explore this further I opened your file and recreated every node prior to the planet in the same TGD, using your BMP as an image. I copied the Base Colours node from one of my other TGDs. This doesn't crash! Connect the surface from Method 1 or 2 and it will crash rendering a preview (usually shortly after the preview render has completed)... every time! There must be a clue somewhere in the code to see what is different between each node.
Had a bit more of a play and it's getting into twilight zone territory. I opened up the TGD where I had duplicated method 1 and then gradually connected the nodes from the original Method 1 branch.
Compute terrain -> Base Colour - OK
Base Colour -> Surface 04 - OK
Image map -> Fractal breakup of Surface 04 - OK
That leaves only Surface 01 -> Planet - Crash after preview completes
Copied both nodes to a text file but I can't see anything that is substatially different ???
I've done about all I can to isolate where the problem is but I have no idea of the cause.
Like said some times before...thanks a bunch for all your time and effort Ben. And also Nikita of course.
I'm glad you agree with me something fundamental isn't correct.
I think the best we can do now is sit and wait for Planetside to elaborate on this.
Both Matt and Oshyan are quite busy I think (still waiting on some reply's in other threads) so I'll wait a couple of days for a response, otherwise I'll PM one of them.
Martin
You're welcome. Don't be surprised if someone suggests a clean re-install ;)
And a little more info for Planetside:
Tested with TGDCLI (alpha)
Preview render completes (actually displays "Finished Rendering") prior to crashing
CLI output just ends with a standard Unhandled exception error
Memory usage not out of the ordinary
Quote from: bigben on May 07, 2008, 11:49:37 PM
No crashing, just a misalignment.
When the render camera is attached the image is stretched vertically. I'll have a play tonight with different render proportions, but looking at this example in isolation it may be that the image width is set to the width of the render, and the height is made the same as the width.
Width:Height here = 1.33 and mask image stretched by 133% to match rendered output
That's correct. If you connect a camera, the shader doesn't know what aspect ratio the camera should be, so it makes it square. This is because your camera might not be the render camera, so it would be wrong for the shader to make assumptions about the aspect ratio. To adjust the ratio you then have to change the Y component of the size parameter in the Image Map Shader (in this case 0.75).
If you do not connect a camera, the camera projection is based on the rendered view, and since it knows the aspect ratio of the render it will fit automatically if the size is set to 1 1 in the Image Map Shader.
I've done it this way so that:
1) there is a way automatically align to the image without worrying about image size or aspect ratio (by leaving the camera link empty, this is the default behaviour)
2) when you need to use a different projection for whatever reason it is independent of your render settings so that you can apply textures anywhere and they will not change if you decide to render an image with a different aspect ratio.
Rule of thumb: if you want to use front projection, don't connect the render camera. It will automatically use the render projection. If you want to project from a different direction, connect a camera to define that projection.
Matt
Quote from: Tangled-Universe on May 08, 2008, 01:08:06 PM
So in conclusion I'd have to paint a mask then resize it to a square image and then resize it back in TG2 using those factors?
The mask doesn't need to be a square image, it can be whatever size you want. You probably want it to have the same aspect ratio as your projection (4/3 for example) so that you have roughly square pixels after all the projections have been setup correctly. None of that will affect how large the image appears in Terragen, however, because that depends on the projection settings.
In summary, the size of your image map in Photoshop makes no difference to how much of the screen it covers in TG, only how much resolution you get from the image.
Terragen then takes that image and maps it to an area which you specify. It would cover the same area even if you only painted a 1x1 pixel image. It's important for a renderer to be independent of texture resolution like this.
For front projection, let Terragen figure out the render aspect ratio and leave the projection size setting at 1 1. To do this you need to leave the camera connection empty. For projections which need to use a different camera, you'll need to tell the Image Map Shader what the projection size is, because the camera is assumed to project a square field of view. 1 1 would project a square. Usually if you are projecting from some other direction you have different needs anyway, so you would need to think about your aspect ratio more carefully.
Matt
An addition I could make is an aspect ratio control on camera nodes. However, I have chosen not to do this because it might be confusing when there are different aspect ratio settings in a render which uses that camera.
T-U, thanks for the files. I will look at the crashes.
Matt
Thanks for clearing tha up Matt. Makes sense now :)
I have just found the source of the crash in the Image Map Shader. This is the crash that would happen when rendering or previewing the shader with "Through camera" projection but without any camera attached. This is the default setup, so it could also crash when you first created and previewed the shader.
This is now fixed for future updates.
One way to work around this problem in the current version is to temporarily attach any camera to the Image Map Shader's camera input and then disconnect it again (this correctly resets the internal value that was causing the problem). Unfortunately that may not be possible when loading from an existing file.
Matt
I'm glad you've found the source and that it will be fixed in future updates.
For now on I'll try to figure out other ways or make use of your work-around.
I could always save the image-map as a clip or remember its settings and insert it prior to rendering, think that should work also :)
Thanks Matt!
Martin
Quote from: Tangled-Universe on May 23, 2008, 05:36:29 AM
I could always save the image-map as a clip or remember its settings and insert it prior to rendering, think that should work also :)
If you pause the preview before inserting the clip, you should be safe.
Matt