Jump to content
The Dark Mod Forums

Supercrumb texture blend experiment


Fidcal

Recommended Posts

Took a few hours to fool around with an idea to extend my crumb idea using a large tile 4096 x 4096 then reducing the scale. It might be effective with smaller tiles possibly 2048 x 1024 for a narrow strip. Possibly less. These 4096 tiles I only used half anyway so the other half could just be normal tiles. Not as great as I'd hoped but I'm sure this can be pushed further. The grass was probably not a good choice as I don't think it has a bumpmap. I still do not understand this alphatest. Doesn't seem to do what it says on the tin. Hope you can zoom this in...

 

post-400-1239471096_thumb.jpg

Link to comment
Share on other sites

That does look pretty good. The image does show some artefacting in the transition area near the viewer, but I can't tell if I'm seeing the crumb pixels or mere JPEG artefacts. Presumably they're not noticeable in motion unless you're looking for them.

 

There are old cards which can only handle 1024x1024 textures - I have one in my ooooold laptop - but the ones I've seen wouldn't be capable of running TDM anyway (certainly my laptop isn't).

My games | Public Service Announcement: TDM is not set in the Thief universe. The city in which it takes place is not the City from Thief. The player character is not called Garrett. Any person who contradicts these facts will be subjected to disapproving stares.
Link to comment
Share on other sites

At the moment its a custom test but if actually used it will be several separate alpha maps* that can be referenced by any texture. BUT (and notice it's a big butt) in order to make the 'crumbs' small enough to be unnoticeable the texture scale has to be small. Hence for most textures it needs a big tile. In this test I took the ordinary 1024 x 1024 grass tile and resized it to 4096 x 4096 (which is a horrible 16 times bigger.) However, this is a first test so I am hoping I can make make it effective at say 2048. In addition, the gradient uses only half the tile; perhaps a quarter would be sufficient. So perhaps a tile 2048 x 512 might work butted against normal tiles. There may be fringe pattern artifacts though. Compare the ordinary crumb dirt decals I've already committed: dirt piles in Saint Lucia; fireplace ash in Chalice. They work reasonably but close up they are not great because the individual dots can be seen and many clump together in an ugly way depending on the alphaTest setting. They are ordinary 1024 tiles.

 

* This test uses a single edge but in practice it might be needed on any edge so I imagine 4 alpha maps with the edge set N, S, E, W on on each. Unless there is some way to rotate an alpha map separate from the texture that is using it. In addition 4 rounded corners probably.

 

Another 'problem' is that I cannot figure out how to get a clean alpha. These dots are 100% transparent. So I would have thought I could use some keyword like maskAlpha to simply not write any areas that are zero alpha in the image. Yet I had to use alphaTest 0.33. Why? I would have thought alphaTest 0 would do it. But I get different strange results throughout the range 0 to 1. I'm not even sure 0.33 is doing exactly what I want.

 

I am using the above supercrumb on water under and overlays too where it is more promising because a plain tile need only be 64 x 64. Here, alphaTest gives good control of murkiness and of course, these tiles are lit locally.

Link to comment
Share on other sites

So if I read that correctly, it actually requires a much larger texture, rather than scaling (I wonder if the latter would work). That's a shame, because if it requires huge, massive textures, it's more sensible just to whip up a model in Blender and do it the standard way.

 

Maybe the thin strip texture you mention will work though; worth a try. I still find it hard to believe there's no way to have a transparency gradient though. I would've thought that would be one of the most obvious and useful things for them to include in their shader tech.

Link to comment
Share on other sites

So if I read that correctly, it actually requires a much larger texture, rather than scaling (I wonder if the latter would work).
By 'scaling' I mean the texture scale in Surface Inspector. So use a tile 4 times bigger then reduce the texture scale by 4 so it shows the same in-game but each 'pixel' is smaller. If you don't then you can see the dots.

 

That's a shame, because if it requires huge, massive textures, it's more sensible just to whip up a model in Blender and do it the standard way.
Sensible yeah - but not available to most. Very few mappers will be modellers.

 

I still find it hard to believe there's no way to have a transparency gradient though. I would've thought that would be one of the most obvious and useful things for them to include in their shader tech.
Me too. It is F ridiculous since it is so close. I cannot even find a simple one-shot single transparency that makes sense. Try making a single hole in a texture. How do you make that transparent? It is 0 opacity and the surround is 1 opacity. Seems easy enough but how?
Link to comment
Share on other sites

By 'scaling' I mean the texture scale in Surface Inspector.

Oh! So that is what you're saying. Well that's good news. As far as I can guess, the cost of that in terms of performance would be zero. No extra work or memory, because it's just the same texture, again.

 

Sensible yeah - but not available to most. Very few mappers will be modellers.

'Tis true. And I'm definitely on the side of arguing for capability in the editor, instead of having to seek solutions elsewhere. (That said, Blender's getting kinda fun. ^_^)

 

I cannot even find a simple one-shot single transparency that makes sense. Try making a single hole in a texture. How do you make that transparent? It is 0 opacity and the surround is 1 opacity. Seems easy enough but how?

I'm not sure I follow. I assume you don't mean a texture with holes in it, because we have plenty of those. Confused.

Link to comment
Share on other sites

Oh! So that is what you're saying. Well that's good news. As far as I can guess, the cost of that in terms of performance would be zero. No extra work or memory, because it's just the same texture, again.
No I think it will still load the full large version of the texture into memory. The scaling is on an individual surface so I doubt doom would anticipate that it is only used once and scale it when loading.

 

I'm not sure I follow. I assume you don't mean a texture with holes in it, because we have plenty of those. Confused.
Describe a def where you have a texture with an absolute transparency hole in it. I'd love to know. If you create such a texture, what do you put in the def?
Link to comment
Share on other sites

Describe a def where you have a texture with an absolute transparency hole in it. I'd love to know. If you create such a texture, what do you put in the def?

Are you talking about this? The texture in question is just the scrollwork. The brown bricks behind it are a different texture:

http://forums.thedarkmod.com/index.php?act=A...ost&id=3224

 

But that's undoubtedly not what you're talking about, especially not after all your crumb experimentation... like I said I'm probably not sure what you're asking. :)

 

Edit: Anyway, considering you're saying you're doing scaling in the editor, and getting results like the first photo in this post, that's fantastic!

Link to comment
Share on other sites

iddevnet gives for alphaTest: "Only write if the alpha value is greater than <exp>" so it seems to me that 1 (in the image) is total opacity and 0 is total transparency. So alphaTest 1 should write nothing because even total opacity in the image is only so it's not greater than 1. And logically alphaTest 0 to 0.99 should write everything that is 1 total opacity. In other words the result should be identical for all values except 1.

 

These screens all show the same texture and the only alpha in the image is absolute transparency or absolute opacity. There is no gradient at all. In order I set alphaTest to 0, 0.2, 0.3, 0.5, 0.75, 0.9, and 0.99. You can see the grass recedes gradually in each shot. If I use 1 then no grass is written which is about the only thing that agrees with the above definition.

 

post-400-1239566681_thumb.jpg

post-400-1239566692_thumb.jpg

post-400-1239566704_thumb.jpg

post-400-1239566713_thumb.jpg

post-400-1239566724_thumb.jpg

post-400-1239566733_thumb.jpg

post-400-1239566741_thumb.jpg

Link to comment
Share on other sites

It's retreating because that is the part where no diffuse exists, correct? For example the crumb textures in the editor show as squarish-round blobs in the center of the texture. The alpha test "tests" where it should and shouldn't draw the texture based on the number you set, like a tolerance. At least, that's my guess at how it works.

 

But if that is correct, have you tried an alpha gradient? Or diffuse gradient with no alpha and alphatest as now?

Link to comment
Share on other sites

Alphatesting is really just that, a test, the outcome can be successful or unsuccessful, yes or no, 1 or 0.

 

It pretty much tests per-pixel whether the value in the alpha-channel of the current material-stage's diffuse-texture, at the current pixel, is greater than the value supplied with "alphaTest x". If this is the case, then the new material will be written to the screen, otherwise, it won't be written at this pixel, and instead the material behind it will show.

 

I hope this makes sense :).

Link to comment
Share on other sites

So we're probably screwed. There's no middle ground -- either 1/0 of alphatest, or translucency level with translucent, which is uniform across the entire texture, but nothing to create a real alpha gradient.

 

It's a shame, but at the same time, Fid's crumbs here are looking really good from what I can see.

Link to comment
Share on other sites

But it's all or nothing is what I'm saying. It's black and white. Off and on. There is no graded, gradual, partial values in the image. There is only 0 and 1 in the image. So how can it vary? Why for instance does alphaTest 0.5 decide to make some of the pixels that are 0 in the alpha to be opaque and others transparent? What is the test? It's almost as if it is testing how close a pixel is to the totally transparent pixels I set when all I want is for to set those totally transparent pixels to be transparent.

 

I tried an alpha gradient before but although you can put it in the image it seems doom is incapable of providing a gradient transparency with local lighting. I can do it with blend blend but then the texture is unaffected by local light so glows in the dark or looks dark in the light. If you have a constant matched light over the whole texture and no dynamic lights it works but of limited use.

 

post-400-1239573891_thumb.jpg

Link to comment
Share on other sites

Well, if it's a tolerance test (which I'm guessing it is), it must test surrounding pixels. At one end of the spectrum it will only consider the test spot or those pixels closest to it. At the other end, it considers many pixels away from the test point, to determine whether to draw or not.

Link to comment
Share on other sites

But it's all or nothing is what I'm saying. It's black and white. Off and on. There is no graded, gradual, partial values in the image. There is only 0 and 1 in the image. So how can it vary?

 

As I understand it, it's testing the pixels to see how transparent they are, and if they fall below the value you set, it calculates them as transparent; if above, then opaque. If you set it to 1, then any pixel with any slight bit of transparency will be rendered as transparent. This usually only affects the border along the transparent/opaque edges.

Link to comment
Share on other sites

As I understand it, it's testing the pixels to see how transparent they are, and if they fall below the value you set, it calculates them as transparent; if above, then opaque. If you set it to 1, then any pixel with any slight bit of transparency will be rendered as transparent. This usually only affects the border along the transparent/opaque edges.
Yes, but in this case there is no 'slight bit of transparency'. Imagine a chessboard image. All the white are alpha 1 and all the black are 0. Nothing in between. AlphaTest should be the same through the range except for 1 because all the 1 values are greater than anything in the range and all the zeros are less.

 

Texture-filtering also plays into this, so some pixels can end up being tested as opaque, even if they are 0 in the texture - simply because the texture-filtering has "smudged" the values into each other.
OK, that makes sense. It shows up more in this supercrumb because the transparent parts are so fine.

 

Incidentally, the best value I found for this supercrumb was 0.33 or thereabouts which is what I used in the first screenshot.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • nbohr1more

      The FAQ wiki is almost a proper FAQ now. Probably need to spin-off a bunch of the "remedies" for playing older TDM versions into their own article.
      · 1 reply
    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 3 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 7 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
×
×
  • Create New...