PDA

View Full Version : Possible to convert greyscale to a texture algorithm?



FilSmith
04-02-2007, 10:13 AM
I won't go into specifics as to why I need this, but I am searching for something a bit different.

I am curious if there is a software or plugin that can convert a greyscale image into an algorithm of sorts compareable to a texture in Lightwave. So that this conversion and generated algorithm could be read as a texture.

Does anyone have any suggestions at all? I know that an algorithm would be complex manually but there has to be a software that can read pixels of a greyscale and then convert into a readable texture.

Any help would be truly appreciated.

mattclary
04-02-2007, 10:48 AM
Can you clarify? Do you need it as a bump map or an image map, or what? Tell us what you are trying to achieve and we can give better guidance.

Sensei
04-02-2007, 11:17 AM
But greyscale image is texture.. ;) If it's applied to 3d geometry..

FilSmith
04-02-2007, 11:21 AM
Well I am looking to emulate a texture. The same way that there is an algorithm that generates say the fractal noise texture. So that my particular image can be applied as a texture. Whether it be for bump or image.
I knew this would be a bit hard for me to explain but let me try again.
I know that the textures that are defaults in the surface editor are generated with an algorithm. Now there has to be a way to take a greyscale image and have each pixel translated to an algorithm that can be reproduced to be used as a texture in the surface editor.

Here is what I am trying to acheive. I am trying to take a basic greyscale, DEM type image to be applied on a displacement map.
Here is the trouble I've been running into so far. Our computers (very low ram pcs) are not made for more complex natures Lightwave can sometimes demand. My boss doesn't understand what spending a bit for decent hardware can do :)
So anyway. I have tried applying this greyscale image to the displacement map with decent ammount of subpatches. Nothing seems to make it very realistic and it is very stressful on my weak pc in terms of RAM. It starts to bypass and use virtual memory in the ranges of 3 gig.
When I did a test with a texture in place of the image map, I got very fast results and they were much more realistic in the look of the geometry.
So if i could find a software to convert the greyscale to an algorithm such as lightwave uses to make the default textures, I could save my pc the pain for one and get a better end result I think.
I have tried the DEM loader and it pretty much shuts my PC down. Just trying to find a good balance of low computer process needed with a good result in the end :P
Any further help/suggestions to get the desired effect without making my pc spin would be highly welcomed :D

mattclary
04-02-2007, 11:37 AM
OK, you want a way to use your image as a procedural, if I understand clearly. That was my first guess as to your intentions.

Nothing I can answer, but my guess is it would be easier and cheaper to upgrade your computer.

If you had a to hire a programmer to do the work, $2000 would probably not be out of the question for the work involved. For that money, you can buy a more potent computer.

You should also consider using Win64 and LW64

I assume the image is pretty big based on the problems you describe?

FilSmith
04-02-2007, 12:42 PM
Yeah. I hear that =) Unfortunately, my boss wants a hollywood production on a trailerpark budget ;) lol
Yes the image is about 3000x4000 approx :)

Sensei
04-02-2007, 01:23 PM
I am afraid converting image to procedural texture is not doable.. And if it would be doable, it would take more time than anything you can imagine, especially on your old machine..

IMHO, if you can't just buy computer, which is the easiest and cheapest way, you can load your greyscale image to photoshop, blur it highly and resize couple times.. And use procedural texture turbulence with small enough size to modulate your image.. That's what everybody uses even if they have really powerful machines - procedural textures have infinite resolution, and add a lot of randomness to image with constant resolution (it's NEVER high enough)..

FilSmith
04-02-2007, 01:53 PM
Ah :) Afraid that might be the answer. Thank you both for your help :)

tribbles
04-02-2007, 02:20 PM
Theoretically, a greyscale image (or even a colour image) can be converted to an algorithm - after all, that's kinda how JPEG works.

If you can translate into a series of waveforms, then that's an algorithm.

Probably too much work though :)

[Actually, it's closer to MP3]

FilSmith
04-02-2007, 04:02 PM
Yeah that's what I was thinking :) I mean...it would be a software that would say "line 1 pixel 1 = binary, line 1 pixel 2 = binary...etc"
Not to say I have the ability to code a program like that....But there has to be something out there like that. If it became a plugin, PCs would be saved alot of work by simply inteprelating a calculated algorithm as opposed to the demanding process it uses for an image.

I mean, if i go into the displacement map and add a proceedural, it is a sizeable fraction of what applying an image map is.

To me, it would seem a much more efficient way of applying greyscale.

tribbles
04-02-2007, 04:33 PM
Sounds like Fractal compression.

Problem is that they're very computationally expensive, and doing a simple pixel interpolation is vastly more efficient.

Sure, it'll compress very nicely, but it'll take a long time to calculate.

Lamont
04-02-2007, 06:27 PM
Grab Infinimap. Sounds like a case where this would work.

OR, save out the displaced mesh and then you won't need the image anymore. OR use APS... there are people on the boards who've used that, so I hope they'd chime in.

Sensei
04-03-2007, 12:20 AM
Theoretically, a greyscale image (or even a colour image) can be converted to an algorithm - after all, that's kinda how JPEG works.

If you can translate into a series of waveforms, then that's an algorithm.

Probably too much work though :)

[Actually, it's closer to MP3]

I don't think so he uses raw file format to store 3000x4000 image on disk already.. ;)

He would need something that does not load image but use it directly from disk, and that's job for Infinimap.. But if his boss does not want to invest in buying new computer, he would not buy single plugin for $360 either!

DogBoy
04-03-2007, 02:38 AM
But if his boss does not want to invest in buying new computer, he would not buy single plugin for $360 either!

True, but as he is only talking about a planar projection he can use the free version.

I was also thinking you could apply your image onto your geometry as a weight map in modeler, then use the weights to affect how much displacement gets done by the procedural, but you will need a heavier mesh and it may not be ideal (or particularly accurate).

regularfry
04-03-2007, 08:23 AM
I'm assuming that the problem here is one of stepping because of the low resolution of the image when it fits in memory.

There are a couple of approaches which might be worth pursuing, one which is a bit of a hack but just might work well enough, and another which would involve writing a plugin.

The first is to take your low-res image and make several blended texture layers from it, each at a slight offset from the one below so that the steps at the pixel edges are smoothed out. I think I'm right in saying that this will mean that LW only holds one copy of the image in memory.

The second would be to write a ProceduralTextureHandler plugin which allows you to load a low-res image and uses it to generate a texture via some convenient interpolation function. Contrary to what's been said above, I don't think it need be overly heavyweight computationally. There are two approaches I'd look at if you wanted to go this route. The first would be a bicubic interoplation, and I'm not entirely sure why LightWave doesn't offer this as an option on image layers anyway - the problem you've come across can't be that uncommon. Secondly, you could take a Fourier series of the image, and use that to generate inter-pixel values. The former will almost certainly give better results, whereas the latter allows for tiling without any extra work.

FilSmith
04-03-2007, 08:48 AM
Excellent! Thank you all for the comments and suggestions. I'll explore into each of these and see if any of them can help me :) More feedback/comments the better!
But if his boss does not want to invest in buying new computer, he would not buy single plugin for $360 either! haha true true! Still trying to get him to buy me FPrime! I plead my case as to how these things save production times (and bottom line dollar costs) but....to no avail ;)
But if Infinimap will solve the problem and give us the needed resolution to this dilemma then he will surely pay it :)

Keep the ideas coming! Great site, great people - I always enjoy reading what you all have to say on all threads. :)

Sensei
04-03-2007, 10:11 AM
but....to no avail ;)

In that case you should be happy that you are even receiving payment for your job.. ;) ;)

FilSmith
04-03-2007, 10:14 AM
HAHA!! Yes. I don't want to give away where I work, but i do believe that for what I work with, I do decent anis and modeling :)
Problem is that we are a thriving company with, essentially, non limited funding, but....sometimes it is like pulling teeth to get the money spent and make the proper people see the value of such "frills" haha! :)

T-Light
04-03-2007, 10:37 AM
FilSmith -

But if Infinimap will solve the problem and give us the needed resolution to this dilemma then he will surely pay it
But for $360 you could buy a machine that can handle those maps :o

Sensei's advice of using a much lower resolution map + procedurals is the way we've all worked for years (and still do). I'd stick with the tried and tested methods and spend any of the money you can tease out of your bosses pocket on new hardware. Then with the next squeeze of the wallet... buy FPrime :thumbsup:

FilSmith
04-03-2007, 11:02 AM
Very true :) And I am trying ;) Slow going :) Would go into details but the "public" forum is dangerous xD

I do appreciate the advice with blurring, shrinking then fine tuning with a texture. Great technique! And I believe that too will solve my problem for the most part :)
Also the infimap plug in may give us some uses that we had needed before as well with satellite imagery. I am truly greatful for all the advice I have received here :) 3D is only part of my job title (pre, production and post) as I am in a pretty unique work environment. Always eager to learn as much as I can from those that walk the walk daily :)

Lightwolf
04-03-2007, 11:13 AM
FilSmith -

But for $360 you could buy a machine that can handle those maps :o

Yeah, but not a farm that can handle them ... :)
Sheesh, I go on my first holiday for 5 years and you guys go all whack and are all over the place ;)

Seriously though. If you need to create terrain out of your map, check out http://amber.rc.arizona.edu/lw/ - TextureScape. It creates an optimized terrain mesh out of a greyscale map (or procedurals). It is a bit crash prone, and don't forget to merge points after creating the mesh. It does work though (I've just created a 700k polygon mesh using it).

You could then use the free version of infiniMap to actually texture the mesh (mind you, I won't complain if you buy a license ;) ).

Using subdivisions for terrain is usually not the best solution (unfortunately, and this include using the new adaptive subdivisions).

Cheers,
Mike

Surrealist.
04-03-2007, 12:06 PM
Using subdivisions for terrain is usually not the best solution (unfortunately, and this include using the new adaptive subdivisions).



Why is that?

Lightwolf
04-04-2007, 01:52 AM
Why is that?
Two main reasons, maybe even three:

1) You can see APS pop when you roam over terrain
2) The final polygon count is hard to control, so you might have an animation that renders fine, but has a few frames where the polygon count goes up extremely leading to low memory situations.
3) There are shading errors on subdivision surfaces that show up (they seem to have problems with interpolating the normals - this seems to go way back to 8.0 which is as far as I tested it).

Cheers,
Mike