Jump to content
The Dark Mod Forums

Feature Discussion: Material Editor


Recommended Posts

While the pre-release testing of the upcoming DR 2.11 is finishing, I'd like to discuss a possible Material Editor feature. Just to get a picture of whether you guys think this is worth the effort, what it should be able to do at a bare minimum, what the UI could look like, etc.

I know this request has been brought forward at least twice in the past, so maybe this feature is worth pursuing.

  • Like 3
  • Thanks 1
Link to post
Share on other sites

This one would be hard, as material in DR would have to look the same in-game, so DR would have to support TDM rendering features. I think correct diffuse, normal, specular, cubemap and alphatest/translucent alpha would cover 90% of cases. Blend add and 64-bit color/bloom would also be nice. Then maybe heathaze and we're like 99% there.

What about the main work area, would that be something like a notepad with autorefresh in 3d preview in the left or right pane? I assume you don't want to do any node-based stuff or implement "intellisense" features like keyword autocompletion or autoclose for the brackets? The later would be cool though, and it would make writing materials much less trial-and-error.

Not sure what do you plan to do about the lighting setup in 3d preview, but there should be an option to move the main light around the shape or a model, usually with a shortcut like L+mouse movement. The camera should generally orbit around the center of the model, and it would be great if it wasn't as wonky and erratic as e.g. the camera in model browser. If you need inspiration for UX and ease of use in this regard, fire up UDK or newer Unreal Engine (or similar). I think it used LMB+mouse movement for orbitting and RMB+mouse forward/back to zoom in and out.

In terms of basic shapes, plane, cube, sphere and cylinder is the usual set, should be switchanble with icons or dropdown list. Ability to override that with path to custom model, so you can test fully unwrapped materials would be an improvement. Oh, and there should also be tiling parameters.

Edited by peter_spy
Link to post
Share on other sites

I know quite a few mappers who shy away from editing and making their own materials, especially when special effects are involved, relying on more experienced mappers for help. Having an editor would probably open up this field to them, in a similar way to what the Readable Editor did for readables. Unlike the Readable Editor, I don't see much need for a WYSIWYG recreation inside DR, though, in particular with the new connection to TDM and hopefully auto-reloading of changed files in both DR and TDM.

I'd imagine this would be like a semi-automatic Notepad-like tool that lets you "add" stages and then "edit" them. For example, add "specularmap", "normalmap" and "editor_image" stages, insert a "stone" keyword, then maybe add a "blend" stage, edit it to "blend add" a "map" and insert i.e. a "scroll" keyword with an option to specify the speed.

This would make it easier and more convenient to make use of features listed on this iddevnet page, though I can see plenty of potential for pitfalls with regards to combinations being generated that won't work ingame. No different from doing it manually, though.

Link to post
Share on other sites

How hard would it be to implement something that autogenerates material files?

 

For example a UI where we select the source TGA/DDS files for the normal map/specular/bumpmap and then DR auto generates the material file for it based on whats selected there. Maybe even an option to copy those files into their respective FM folders?

 

Just something to automate the process a bit more would be handy.

 

One problem with this though is the lack of a dark mode in DR would make staring at black text on a white background very uncomfortable as we look through the material files (unless i'm misunderstanding what you're proposing here). Currently I use notepad++ to edit my MTR files, because it's a lot easier to look at.

Link to post
Share on other sites

I actually didn't plan to create a notepad replacement, because it misses the point of a Material Editor for me. Why not edit your .mtr files and hit reloadDecls in-game just as fine?

I was thinking more along the lines of the particle editor, which provides entry boxes, sliders, controls, etc. to develop the material stages. A preview is a must too.

  • Like 1
Link to post
Share on other sites
28 minutes ago, greebo said:

I actually didn't plan to create a notepad replacement, because it misses the point of a Material Editor for me. Why not edit your .mtr files and hit reloadDecls in-game just as fine?

I was thinking more along the lines of the particle editor, which provides entry boxes, sliders, controls, etc. to develop the material stages. A preview is a must too.

Ah I see, I misunderstood what you meant sorry.

 

When you said material editor in my head I was thinking something in DR that edits the material MTR files not the textures themselves.

Link to post
Share on other sites

Yes, the goal of that whole thing should be to make it easier for users to 1) create the materials for their missions and 2) make it easier to experiment with the various keywords and settings.

With regards to the lighting preview, I think that DR is not in a too shabby state. We added support for most material keywords and blend stages years ago, and as you can see in the particle editor the blend stages are not a problem. We even have shader expression evaluation support including simulating the rendertime, like "translate time*0.3*shaderParm6".

Link to post
Share on other sites

IMO a material editor would be awesome.

btw some people don't know but original idtech 4, comes with a material editor included, but I assume most don't use it, mostly because, they prefer to edit the materials by hand but this is because the material editor, like almost all original idtech 4 tools, has a tendency to crash, it can also sometimes corrupt the material definition file and is not very user friendly, so people avoid using it, but a good stable material editor, would get users i'm certain.

About what it should have and look like, first imo the most important feature of the material editor is the preview, if possible, it should be a accurate representation of how it will look like ingame, second it needs to support all original idtech 4 material key words (and of course new TDM ones), it should at lest, support materials with GLSL shader stages in the preview, supporting old ARB ones would be nice (for those working with Dhewm 3 engine for example) but I comprehend if it doesn't get included.

How it could look like, I really don't know, i've not used many material editors before to make a comparation, but imo the Unity suggestion is a good one, you guys could also look at the material editor that comes with original idtech 4 (but of course improve on it). One thing that imo it needs thou, is the ability to edit the material code by hand in the editor, if you so desire, for example, if you know a keyword by memory, you don't need to search for it, just open the material code section/tab and input the keyword by hand there.

It should be able to open and save multiple materials, found on a single .mtr file.

This is what comes to mind at the moment.    

Edited by HMart
Link to post
Share on other sites

I had been tossing this idea around in my mind as well, but struggled to come up with a UI idea that could handle all the available material options without becoming overwhelming.

One idea I came up with was extracting all the keywords out of existing materials in order to determine which ones are used the most, and then making a "basic" configuration with only the most common ones.  This would be optimized for easily bringing in your own textures with little additional modification, and then have the "advanced" version which exposes the less common flags for building specialized materials.

On 1/24/2021 at 4:06 AM, Zerg Rush said:

Can this serve?

http://neotextureedit.sourceforge.net (FOSS)

I hadn't considered a node-based approach, but at first thought it could be well-suited for the way that material stages work.  Considering how common node systems are nowadays, it might be an intuitive way to go.  On the other hand it might add complexity to creating materials that just load a texture.

This might be a little tangential, but I didn't realize you could actually see a material's definition from inside DR until recently.  I always went hunting for the name directly in TDM's .mtr files.  It would be nice to be able to easily load an existing TDM material into the editor, make tweaks, and save it to your map-specific .mtr file.

 

Link to post
Share on other sites
  • 1 month later...

It looks suuper busy, but it seems like it covers most of the material options. I hope you worked with a group of content creators and got regular feedback on that. Still it wouldn't hurt to release this in increments, so the end users can get accustomed to the new thing.

As for the material preview, there should be an auto-rotate toggle, as well as more lighting setup options. The most typical is key light only, key light + backlight, or the 3 light setup. Also, these lights should probably have their basic properties configurable, as non-pbr materials are lighting-dependent. At least stuff like RGB/HSV values, light texture, radius, with some recommended defaults.

Link to post
Share on other sites

Looks promising. I agree with peter that beeing able to configure the light used in the preview would be useful. I am not sure whether several lights are necessary, but beeing able to set the light color and texture would be useful as the lights often used in fms (torches, candles etc...) differs heavely from a plain white light.

Thanks for the effort.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to post
Share on other sites

I like it, seems to be very complete even at this early stage, it doesn't look hard to use but is obviously geared to people that already know the TDM/idtech4 material system and not for those just starting but with a good help system I'm sure anyone will pick it up fast.

I know is still WIP so perhaps this is already in the TODO, but if it is not, I also agree about configuring the lighting, on the doom 3 material editor for example, you can create any amount of lights you want and give them the color/material you want, you can also move them around.

Also besides the flat plane, cube and sphere models you can also import a custom model to preview the material on it, imo seems to be a nice feature. 

Btw greebo the Doom 3 material editor, writes a comment saying that the material was made by it, so if is not already, I think yours should do the same, personally, I think is a good way to detect what was written by hand or by the editor, good for detecting when the editor bugs out when writing the materials. 

Edited by HMart
Link to post
Share on other sites

I'm worried that it's geared mostly to veterans, it will overwhelm newcomers with the sheer amount of information visible on the screen.

One thing I'd rethink immediately though would be the material browser. It occupies a lot of space, and the usual material workflow isn't about jumping between several materials, it's focusing on one of them. That space could be used by actual material stages IMO.

Edit:

And just as the case automation feature, this seems to be informed by the underlying tech, not actual user needs. While in most cases, users will just want to add diffuse, normalmap, and perhaps a specularmap, and be done with it. Next priorities might be: adjusting the alphatest value for diffuse, if it has alpha; adding cubemap reflection; adding emissive / glow map. And in these things alone you have like 90% of materials.

Edited by peter_spy
Link to post
Share on other sites

I agree that it could be divided into a basic and advanced section, if is not hard to do the seperation, in the basic section you cant do much, just apply diffuse, bump and specular textures and say what surface it is, wood, metal, etc, just a way to create fast basic materials and on the advanced tab, you have the real deeper material editor options, where a advanced user will work on stage effects and apply ARB/GLSL programs etc. 

Edited by HMart
  • Like 2
Link to post
Share on other sites
22 hours ago, peter_spy said:

I hope you worked with a group of content creators and got regular feedback on that.

You mean, I should open a forum thread to get some thoughts before I even started? And post screenshots as soon as I have something?

It's the fricking internet after all, where nobody has to deal with anybody else in person, and you might happen to be a fun and relaxed guy in real life, but getting this tone in return when asking for feedback is not exactly what makes this funny for me. I'm always open to listen to mappers, especially mappers, but l need constructive feedback to work with.

I'm totally aware that this is not exactly a simple GUI to set up a material in 5 seconds. I have thought about having two "modes", where the simpler one hides most of the controls, where one just sets up the diff/bmp/spec triplet. It's just not there yet, and it was indeed not even the goal for this first iteration, but I can hear you guys that it looks like an airplane cockpit right now. Or maybe that simpler GUI ends up as a separate "assistant"-style dialog on top of this one? Or maybe a separate "Material Creator" GUI that is using the same preview but just features a few controls (no selecting of existing materials, just creating new ones)? Ideas?

On 1/23/2021 at 5:00 PM, greebo said:

the goal of that whole thing should be to make it easier for users to 1) create the materials for their missions and 2) make it easier to experiment with the various keywords and settings.

I've been working on the harder part of that quote, which was #2. Like the particle editor, it should be able to open existing materials, such that users can inspect and play around with them, talk about full syntax support. So I needed to make sure it is able to display every TDM material you throw at it, and looking at the now-defunct iddevnet.net materials page there are heap loads of options - that's why there are so many controls. It should be able to open any existing material, change anything in there and hit the save button without it destroying the original material syntax, which is not going to be easy.

My ToDo-List is looking like this:

  • Make DR materials reponsive to changes, so the preview reacts to it
  • Get DR to export materials that have been edited
  • Get the DR renderer up to speed, it doesn't support most of the less widely used keywords
  • Improve the lighting preview scene with configurable light parameters
  • Create that "simple" mode

Each of these steps will take weeks, so we're still at the beginning of that story.

But still, if the majority of mappers here thinks that this GUI will be a perfect waste of time, because 1) too complicated and 2) nobody wants that anyway, then please tell me right now. I'll focus on a mini-GUI with diffuse/bump/specular and forget about the rest.

22 hours ago, peter_spy said:

Still it wouldn't hurt to release this in increments, so the end users can get accustomed to the new thing.

I'm pushing the commits to github on an almost daily basis. I know that some mappers used to build DR from source for personal use. Anyway I was thinking it would be nice having an automated nightly build which is just building and publishing whatever the code currently is looking like. I don't have such a setup though, I need to spend some time playing around with Github CI, never touched it so far.

Creating a new build every day manually is too much work for me for little benefit, to be honest.

Link to post
Share on other sites
25 minutes ago, greebo said:

You mean, I should open a forum thread to get some thoughts before I even started? And post screenshots as soon as I have something?

Not exactly, I meant working in modern iterative approach, where you discuss features with users first, do some mockup drawings with whatever method you prefer (everything from post-it notes and pencil drawing to apps like draw.io or invision would do). Then it's establishing the MVP. In this case it could be e.g. an editor that allows you to assign diffuse, specular and normalmap. Then it's releasing that, getting feedback from users and planning next steps – in the most simplified way of describing it. It's not about dumping the whole solution onto users, and it's not about pushing commits. It's about communication with end users and, establishing milestones and gradual releases. That's what you typically do in modern software development.

[Edit] This way you'll waste less time on e.g. stuff you thought users will need, but they actually don't. Or you don't have to spend so much additional time to rework the whole thing, because users expectations we're completely different from your assumptions. Which IMO is important, because it's your personal time, and doing stuff for others is an act of communication, whether we like it or not, so that user feedback, however harsh, is kinda inevitable.

Edited by peter_spy
Link to post
Share on other sites

I think I could start using and learning from this editor immediately.

Writing materials by hand, which for me is largely copy/paste/editing to serve the purpose good enough, leaves a messy result requiring a tedious rewriting fix.  Time better spent learning how to use such an editor.  Looking forward to it.  Thanks. 

 

Link to post
Share on other sites

I'm very much looking forward to the material editor as I think it would open up a lot of the material system's potential to mappers. It'd be a major improvement over how I imagine most mappers to interact with the materials system, which is to copy an existing material, update the image paths and maybe copy-paste in something one has found in another material.

I think the main purpose of the editor is to 1) show what options are available, 2) apply them so that the mapper doesn’t have to worry about syntax. In an ideal world it’d also show an accurate preview, but I still think this is of secondary importance given the difficulty of replicating TDM’s rendering in DR and the existence of the new TDM<>DR connection feature. For mappers it’d arguably be even more realistic to view their custom materials ingame in the actual map. But for strict non-mappers there should be at least some preview support.

Maybe some “basic” or “common” settings can be identified, like diffusemap & normalmap. These are settings that are shown in “basic” mode and that the DR renderer should be able to portray.

Link to post
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.

×
×
  • Create New...