Jump to content
The Dark Mod Forums

Texturing Patches


Recommended Posts

I played around a bit with copying over the textures from other patches (similar to the way the PasteNatural works with brush>patch), this is issue #116:

 

Before:

patchbeforevs2.th.jpg

 

After pasting the texture from the left to the right patch:

patchafterng9.th.jpg

 

What's actually happening is not that perfect as it may seem. The requirements for this to work are currently that the patches have to share at least one control vertex and the target patch has to be textured very similar to the source patch (this means that both are stretched and rotated the same way, such that a simple texture shift is enough to make the transition seamless). The distance in texture space is calculated and susbtracted from every target control vertex, hence the difference disappears for the shared control vertices. It's some kind of assistant that helps shifting the texture into the right position.

 

I'll look into it a bit more deeply tomorrow and see what I can come up with.

Link to comment
Share on other sites

Are you able to just get the texture coords at the exact point where one patch ends, and then (regardless of orientation, or position) just start pasting it exactly from that spot on the nearest edge of the second patch? That's what I originally assumed would be the action.

 

Either way, the image above looks great!

Link to comment
Share on other sites

It's similar to that. What happens is the same as when the mapper manually shifts the texture up and down via the patch inspector.

 

It most probably doesn't work when the target patch is moved away from the source patch, because the routine for compensating the 3D distance is not yet implemented, although I already have some approach that I need to test.

Link to comment
Share on other sites

Ok, I think I'll commit it that for the moment, as it is an improvement over the previous patch>patch pasting.

 

I'll put another build on the FTP for you to play around, SneaksieDave. Remember that the target and source patches have the be textured with the same scale and rotation, then the PasteNatural operator works quite ok.

 

http://208.49.149.118/TheDarkMod/download/....8.x.rev970.zip

Link to comment
Share on other sites

Edit: hang on I may have made user error (after a 45 min post preparation!): update to follow shortly...

 

Edit: I think I misunderstood the functionality. Let me clarify - the implementation is that now (for example) both sides of a doorway arch can both be taken from the same ceiling piece (without the mirroring that used to happen) with shift-MMB, not that shift-MMB works from patch to patch?

 

Edit: No, that can't be it, because that already worked. greebo, I'm really confused.

Shift-MMB from patch to patch does something new (sometimes??), but I get flipping and alignment issues.

http://img62.imageshack.us/my.php?image=align1ka2.jpg

That's either shift-MMB from left to right or ctrl-MMB (I can't tell anymore - sometimes it seems to do something, other times not). I've spent two hours on this this morning and I'm just as confused as I was to start! :P

 

http://208.49.149.118/thedarkmod/maps/align.zip

Link to comment
Share on other sites

From the bugtracker notes:

I *think* this is working, but I'm getting some inconsistent results. Working through it, I think I'm starting to understand these results though. For this example, I'm using two mirrored bevels, as in a doorway arch.

 

Assume that patch 1 is already textured as desired, and done.

 

Case 1. Doing "natural" (the button) on patch 2, followed by any necessary rotation, and then shift-MMB from patch 1 to patch 2 seems to work. Okay.

 

Case 2. Same as above, but using ctrl-MMB. Seemed to work. Should it?

 

Case 3. Doing "natural", followed by necessary rotation, followed by alt-MMB (in case you hit the wrong keystroke), and THEN followed by shift-MMB does NOT work. It apparently "breaks" the functionality somehow. You must do "natural" again to get it to ever work on that patch again.

 

Case 4. Not doing "natural" at all opens a can of worms, and will lead to unpredictable behavior.

 

So, there seems to be something weird in there, remembering the alignment and not letting the user reset it after messing up? The natural button is needed to reset it.

SneaksieDave, I get the impression you're getting more and more lost here, which I think is because you want the texture tools do things they're not designed to do.

 

Generally spoken, I don't believe that I will ever be able to cover every kind of texturing situation (virtually impossible). We'd end up with DarkRadiant having 25 different sorts of texturing commands, each working slightly different.

 

I suggest that I will document the implemented features first and explain the background of how they work. Then we can go ahead and do some tutorials or whatever to explain how common texturing situation can be mastered with the given tools. Specialised situations will probably always be up the mapper to tackle, because it is an art after all.

 

If a common problem can be nailed down and reliably described, then I'll happily try to code some algorithm that are able to ease the mapper's pain (if that is possible at all from the coding point of view).

Link to comment
Share on other sites

I'm really only talking about one thing here that doesn't currently exist, and speaking about a couple of possible bugs (the same that existed with alt-MMB when all of this started). I realize not every case can or should be handled. I'd think aligning texture between two adjacent patches is probably a basic need, just like brushes...?

 

Edit: I'll try to get my post together ASAP, you'll see what I'm talking about.

Link to comment
Share on other sites

Okay here we go. The following are items I've learned to use the system to do, and the last one is one I haven't figured out yet (assuming a way exists). If not, that's what's being requested. That, and flipX, flipY were really the only requests that have been made, aside from the alt-MMB bugfix. I'm certainly not asking that all cases be covered; just these fundamental, important ones. Basically it all comes down to a way to align patches similar to that in the fourth example. If anyone thinks of more, please speak up.

 

Problem 1: Align vaulting to ceiling

http://img128.imageshack.us/my.php?image=patchtex1gs8.jpg

 

Solution: MMB on ceiling brush, then shift-MMB on patch. Being near the edge of the brush helps prevent distortion.

http://img266.imageshack.us/my.php?image=patchtex2tj0.jpg

 

 

Problem 2: Align vaulting to vaulting

http://img266.imageshack.us/my.php?image=patchtex3mh9.jpg

 

MMB brush, shift-MMB patch: expected result, but not really useful here

http://img70.imageshack.us/my.php?image=patchtex4cj3.jpg

 

Rotate the above 90 degrees: not a great result, could be better

http://img266.imageshack.us/my.php?image=patchtex5sb1.jpg

 

Solution: Not a perfect solution, but it looks best in my opinion - MMB patch, shift-MMB patch2 (transfers textures), alt-MMB patch (transfers alignment). Minor tweaking and you're done.

http://img128.imageshack.us/my.php?image=patchtex6cp9.jpg

 

 

Problem 3: Align inside of arch

http://img266.imageshack.us/my.php?image=patchtex7ev8.jpg

 

Solution: MMB ceiling brush, shift-MMB each patch

If you're close enough to the edge of the ceiling, texture is aligned and continuous (not mirrored) across the two patches.

http://img70.imageshack.us/my.php?image=patchtex8ms9.jpg

If near the center of the ceiling/not near an edge, you'll get mirrored alignment.

http://img128.imageshack.us/my.php?image=patchtex9pd5.jpg

 

Both are considered useful.

 

 

Problem 4: Align front face of arch

This is the case of alignment of patch from neighboring patch.

http://img266.imageshack.us/my.php?image=patchtex10vx4.jpg

 

For this, I have not yet found a good solution.

 

-MMB brush, then both patches - not aligned

-FlipX and/or FlipY of the above - not aligned

-MMB patch1 -> shift MMB followed by alt-MMB patch 2 - not aligned

-Flipping above - not aligned

-Moving toward edge of ceiling brush didn't help

-Natural, and then pasting the texture from texture inspector didn't help

 

Each result was some variation of the same problem:

http://img128.imageshack.us/my.php?image=patchtex11pa0.jpg

 

Here it is in DoomEd, Natural setting (resized). It's basically continuous inverted, not mirrored. It's not perfect, but in the case of this texture, it works.

http://img128.imageshack.us/my.php?image=patchtex12mt9.jpg

 

What I'm hoping is possible in DarkRadiant is behavior such that the rightmost coords of the texture on the left patch can be used to determine the leftmost coords of the texture on the right patch, and the texture continues with the same alignment from there.

Link to comment
Share on other sites

I think the best solution to problem 4 is geometric - make the front face out of a single patch rather than two patches which meet in the middle.

 

Alternatively assuming your texture is tileable (which it presumably is), you might be able to do a "Fit" operation whereby a single (or 2, or 4...) instance of each texture is fitted to each patch, which should provide a seamless join.

Link to comment
Share on other sites

Damn! I got really excited when I read your second suggestion, almost positive it would work... but it didn't. :-/

 

The problem with single geometry comes if you want to be able to do more diverse things with it (like have it bend on the other axes too - like that guy that did the advanced arches map somewhere on d3world) or if you don't want a full arch. Or, when it's not even an arch (this was just a simplified example to make the request clear).

 

For now at least, I can still open DoomEd and get the mirror alignment, if worse comes to worse. Also, there is the option to just twist and shift it around until I eventually get the right orientation by hand. Took me long enough before that I gave up though, and went to DoomEd. ;)

 

Is it really tough to get edge coords and continue from there on the next patch?

Link to comment
Share on other sites

Damn! I got really excited when I read your second suggestion, almost positive it would work... but it didn't. :-/

 

It seems to work if you create the right hand patch by duplicating and rotating the left-hand one, rather than duplicating and flipping. Presumably this is because the flip operation inverts the texture coordinate mapping in some way whereas rotation leaves everything pointing in the same direction.

 

Perhaps what we need is a Matrix->Flip operation which leaves the shape of the patch the same but renumbers the control vertices in the opposite direction, so that the texture operations work as you expect.

Link to comment
Share on other sites

Yes! Thanks Orb, that tip worked. What I did: create bevel, thicken, then copy and rotate around Z. All of this with no mirroring or rotating about X or Y. Since patches seem to always be oriented about Z/top-down, it's usually the first thing I do, to rotate and orient them properly. In DoomEd, I quickly learned not to do that, because if I did, any operation on them would crash. <_< So naturally in DarkRadiant's non-crashyness, I didn't bother with that hand-holding. ^_^

 

Anyway, so we can align two front faces of an arch. Woot. Just do it before any rotations or mirroring are done on the patch.

 

The request still stands, of course. ;) Being able to align edges of any patches (not just front faces of arches) would still be great, but this alone drops it out of the "essential" category and puts it more in the "when time permits" and "if possible" categories. And the matrix flip thing would probably be a welcome addition nonetheless. More tools = better.

 

#4 - Solution: Do your texture alignment before rotating or mirroring the patch along X or Y axes.

 

Edit: Oh! Forgot to mention - the initial result was not perfect - I had to shift the texture by about 64 units - but it was otherwise aligned.

 

Funny that the end (well, sorta) of this problem resembles a rainbow.

post-58-1171578279_thumb.jpg

Link to comment
Share on other sites

Is it really tough to get edge coords and continue from there on the next patch?

I assume that this can be done by assimilating the texture coordinates of the shared control points. I'll implement it tomorrow and let you test it, ok?

Link to comment
Share on other sites

Beware that there might be heavy distortions going on if the control points share the same spot in 3D space, but are very distant in texture space. Just assimilating the texture coordinates could lead to a distorted texture between the changed vertices and the unchanged ones. Let's see if that feature is any good. :)

Link to comment
Share on other sites

This is the current result:

 

Before & after:

stichtextures1yf1.th.jpg stichtextures2pu4.th.jpg

 

The first picture shows the two patches in the original state: the right one is the source patch, the left one is the target patch. The right one is textured as desired, and the second fulfills the following requirements:

 

- It's textured in the same rotation

- It shares at least one control vertex with the source patch

 

The actual U/V coordinates of the left patch are way off from the first one (its UV coordinates are in the range of 50, the source patch has its UV around 0 to 1), but that's not that important, I just wanted to add that the "StichTexture" command can handle this as well.

 

The steps to get the above result are:

- Select the source patch

- Select the target patch

- Select the command Curve > Stitch Patch Textures

 

What's happening is: the target patch is shifted around in texture space until it's as near as possible to the source patch (distance

 

This means: the better the target patch texture is aligned to the source patch before stitching, the less it is distorted after the operation.

 

I'll commit these changes and do a snapshot build for you, watch out for an edit of this post.

 

edit: Get the snapshot here: http://208.49.149.118/TheDarkMod/download/....8.x.rev985.zip

Link to comment
Share on other sites

Wow, that's interesting and should definitely be useful, especially with terrain patches! I couldn't use it to make the arch faces align, but that much is to be expected, as the layouts of the patches are completely different. Is there any way to get rid of the drift that it does toward the front edge of the left patch, and instead keep it going with the original alignment?

 

Either way, it's another cool tool for the toolbox. :)

 

Note: I had a crash on resizing the camera window - I haven't reproduced it yet, so I'm not sure what may have caused it. I assume it's not related though.

Link to comment
Share on other sites

Here's a general question (not a request, necessarily). I'm not sure if,

a.) I just don't know how to do this,

b.) there's a possible bug which prevents this, or,

c.) there's currently no way to do it

 

See the image below. In testing out the texture stitching, I used the left patch stitched to the top right, and then the bottom right stitched to the top right. These were the expected results, because the patches are completely different in grid space. What I'm interested in is the flattened, warp section of the texture in the middle, because the endpoints meet up nicely.

 

We have the S and T fields. These have wacky calculated values in them where the editors handle texture layout for us and spit out a number we can see or modify if we're daring enough. The other dimension is the dropdown boxes above these fields, with values of 0,1,2 and 0,1,2. These correspond to the control points. For example, changing values on 0,0 will move one of the corner control points. And changing S and T for 0,0 will affect the shift and what appears to be the tile values. Sometimes these are actually useful. :)

 

What I'm wondering is the following:

How to affect the texture at the center of the bend, the flat warped area? One would suspect they could by going to coordinates 1,1; 0,1; and 1,0. But changing the S and T values for these points does nothing at all.

 

Is this a bug? It seems so. And it's in both DarkRadiant and DoomEd. Or is it just impossible to affect the texture layout at those points through these editors (or even the game itself)? "Natural" does it, so surely it can be done, but why were we not given that ability? It'd certainly be useful, and consistent, to be able to affect the texture at all three sets of control points instead of just the ends.

post-58-1171648130_thumb.jpg

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

      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 )
      · 2 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
       
      · 5 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...