Jump to content
The Dark Mod Forums

Texture Copy/paste


Recommended Posts

:blink: If you figure out a way to handle that, you will have solved one of the biggest and most persistent texturing problems known to man and woman alike.

Done :). I wasn't able to commit this during the last weekend, because my DSL went down till today.

 

Basically, it's now possible to seamlessly texture a brush/patch transition, such that the texture is preserved in scale, shift and rotation.

 

So it looks like this (left is the patch with its control vertices, right is the untextured situation):

 

complexpatchoy6.th.jpg complexpatchbeforeyx0.th.jpg

 

One is now able to choose between two texture copy modes: 1) Projected and 2) Natural

complexpatchprojectedjy5.th.jpg complexpatchnaturalik5.th.jpg

 

The result on the left is the projected texture copy (note the distortions on the patch). However, for coplanar patches and inverted end caps this works like a charm. The right image was done with the new command ("PasteTextureNatural") accessible via Ctrl-Alt-Shift-MMB. This virtually "flattens" out the patch and therefore allows undistorted texturing, as the 3D distance between two control vertices is taken to calculate the texture coordinates. The result is undistorted and of course seamless to the adjacent brush.

 

2. The ability to undo transformations. At least I should be able to undo them to the state that existed before I opened up the texture window or before copying a texture's orientation. In D3ed, sometimes I'll work for a half-hour, iteratively rotating, scaling and shifting a texture until it matches a brush... then I'll accidentally middle click another brush or some such, and lose all that work.

I think this already works in DR. At least the above steps are all undoable as far as I know.

Link to comment
Share on other sites

Can the projection mode also be changed on an existing patch? It might be nice to have extra options in the surface/patch inspector to change the texture projection in this way.

No, after the texture coordinates have been calculated, they are "baked" into the patch, there is no meta-information available à la "this patch was textured using brush and scale using face normal vector". However, as the originating brush face is saved in the clipboard, you can check out both results by just using different modifiers (Ctrl-Shift-MMB for projection, Ctrl-Shift-Alt-MMB for natural, by default).

 

:blink:

*drops D3Ed* (well... almost ^_^)

You guys are all over this thing. When's the next build release?

That depends on when we reach the next stable state between the feature implementations. Orbweaver is working on some inspectors at the moment, I don't know how much is still left to code. Perhaps there will be some christmas release?

Link to comment
Share on other sites

No, after the texture coordinates have been calculated, they are "baked" into the patch, there is no meta-information available à la "this patch was textured using <this> brush and <this> scale using <this> face normal vector". However, as the originating brush face is saved in the clipboard, you can check out both results by just using different modifiers (Ctrl-Shift-MMB for projection, Ctrl-Shift-Alt-MMB for natural, by default).

 

Fair enough. If only there was a more intuitive inteface than triple-modifier-clicks -- perhaps I can stick in a dialog or something at some stage (the best solution is probably Blender's little pop-up menus, but those don't exist in GTK as far as I can tell and would probably be more confusing as they are a non-standard idiom).

 

That depends on when we reach the next stable state between the feature implementations. Orbweaver is working on some inspectors at the moment, I don't know how much is still left to code. Perhaps there will be some christmas release?

 

I think we should soon be ready for a 0.8.0, we have some fairly important new features (fixed patch texturing, light inspector, projected light support, draggable light centres, entity chooser hierarchy based on key in DEF file). I have recently started on the generic skin selection dialog, but this could conceivably wait until 0.9.0 (along with at least one of the new Dark-Mod specific editors) depending on how long it takes.

Link to comment
Share on other sites

Fair enough. If only there was a more intuitive inteface than triple-modifier-clicks -- perhaps I can stick in a dialog or something at some stage (the best solution is probably Blender's little pop-up menus, but those don't exist in GTK as far as I can tell and would probably be more confusing as they are a non-standard idiom).

At least it's customisable, so the users can choose what mouse buttons and what modifiers they want to use. (Not quite like a pop-up menu, but I don't like those too much anyway...)

 

I think we should soon be ready for a 0.8.0, we have some fairly important new features (fixed patch texturing, light inspector, projected light support, draggable light centres, entity chooser hierarchy based on key in DEF file). I have recently started on the generic skin selection dialog, but this could conceivably wait until 0.9.0 (along with at least one of the new Dark-Mod specific editors) depending on how long it takes.

I'll finish reorganising the brush.h header file, and then I will look into the upgradepaths / xml file handling. Once this is done, I would say this thing is ready for takeoff.

Link to comment
Share on other sites

I just tried this out, and it works like a charm. I think we can simplify the modifiers a bit -- there is nothing else using MMB in the camera view AFAIK so we may as well use something easier to remember. I find MMB for copy, Ctrl-MMB for paste projected and Ctrl-Shift-MMB for paste natural to be quite comfortable, although you may have a better suggestion.

 

One thing I think we should change is patch creation - currently this does not delete the selected brush which I find inconvenient and will probably confuse DoomEdit users.

 

Also, I retract my suggestion that the control system should be inverted so the target patch copies its texture onto the currently-selected patch. The ability to copy a texture once and then rapidly deploy it onto numerous surfaces seems to be advantageous. However we must make sure that the undo support is impeccable in case a user targets the wrong patch -- which I think it is, based on cursory testing (i.e. I tried it once).

Link to comment
Share on other sites

I just tried this out, and it works like a charm. I think we can simplify the modifiers a bit -- there is nothing else using MMB in the camera view AFAIK so we may as well use something easier to remember. I find MMB for copy, Ctrl-MMB for paste projected and Ctrl-Shift-MMB for paste natural to be quite comfortable, although you may have a better suggestion.

Perfectly ok with me, feel free to change the default settings in input.xml, mappers will always be able change it to something different.

One thing I think we should change is patch creation - currently this does not delete the selected brush which I find inconvenient and will probably confuse DoomEdit users.

You mean if there is anything selected and the user hits Shift-P the patch gets created and the brush stays there? Should the selection really get deleted on patch creation? I wouldn't like this, so I would make this a configurable option (i.e. registry key value).

 

Also, I retract my suggestion that the control system should be inverted so the target patch copies its texture onto the currently-selected patch. The ability to copy a texture once and then rapidly deploy it onto numerous surfaces seems to be advantageous. However we must make sure that the undo support is impeccable in case a user targets the wrong patch -- which I think it is, based on cursory testing (i.e. I tried it once).

Yes, I like the clipboard idea more than DoomEdit behaviour. If I was to implement D3Ed style texture copy, I would have made it an option, because I find it much less effective.

Link to comment
Share on other sites

I've committed the "Paste texture coordinates" methods to SVN. Mappers can now clone texture coordinates from one patch to another patch of the same dimensions (the shader stays untouched):

 

texturecoordcopy1zb5.th.jpg texturecoordcopy2zp5.th.jpg

The left patch is the source patch, the right one the target patch (but this can of course be reversed as well). One has to copy the texture from the one patch into the clipboard and paste the coordinates then via Alt-MMB onto arbitrary patches (with matching dimensions).

 

texturecoordcopy3an4.th.jpg texturecoordcopy4fz8.th.jpg

Same as above, but now the shader image is the same for both patches.

Link to comment
Share on other sites

The texture (i.e. shader image) itself on the target stays untouched, it's only the texture coordinates that are being transferred (like in the shots in the first row in my above post). Maybe this comes in handy.

Link to comment
Share on other sites

See the way in this image,

texturecoordcopy4fz8.th.jpg

there is rippling at the bottom half of the texture? It's easy to see with the carpet lines.

 

However in this one,

texturecoordcopy2zp5.th.jpg

there doesn't seem to be the same distortion. Or at least, it's harder to see.

 

Anyway, I guess the point is: if there's no distortion on an un-fitted texture:

texturecoordcopy3an4.th.jpg

then why would a fitted texture necessarily show rippling? It's still ultimately just a texture, fitted, and laid across the same surface as the tiled one. Squeezing of the texture, to make it fit, yes. But the rippling almost suggests an imprecision maybe, or rounding problem? (I might be completely wrong here.)

Link to comment
Share on other sites

The "rippling" happens because the patch is internally subdivided into a series of triangles for rendering, each of which only has three texture coordinates which means the texture cannot "bend" within the space of a single triangle. You could improve the smoothness of the distortion by adding more triangles, but this would obviously have a performance impact.

Link to comment
Share on other sites

Makes sense. So is it just not (as) apparent in the second image?

 

Yes. If you look closely at the lines you can see there is some jaggedness there, but it is not as pronounced since there is no regular grid pattern.

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

    • 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
       
      · 2 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
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
×
×
  • Create New...