Jump to content
The Dark Mod Forums

Apples and Peaches: Obsttorte's Mapping and Scripting Thread


Obsttorte

Recommended Posts

Very cool! How does that work?

I'll add an explanation here once I'm done fine-tuning it.

  • Like 1

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 comment
Share on other sites

You are welcome:)

  • Like 2

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 comment
Share on other sites

Short answer:

  1. You could either use a brighter texture or brighten the image in an image manipulation program. Another way is to alter the shader program
  2. and 3. see updated pk4 attached

Long answer :) :

 

 

blend.pk4.txt

blend.pk4.txt

  • Like 2

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 comment
Share on other sites

Interesting stuff.

 

Not to be a "Debbie Downer" but it seems that this takes almost as much work as making your own custom texture

with the blend.

 

Also, if I'm not mistaken, you can already mix diffuse stages with a bias image and the "add" keyword:

 

texture_1 = stone, texture_2 = grass, bias_texture = greyscale blend image

 

diffusemap add(add(texture_1, bias_texture),(add(texture_2, invertColor(bias_texture)))

 

so custom arb would not be needed here.

 

Ideally, we would want this to work like a decal where the bias texture would have it's own texture matrix.

 

I suppose you could make a decal that performs the same blend as the above but one of the diffuse textures

would be _currentRender (using something like the heathaze shader).

The problem being, of course, specular and bump. You'd need to remove them from the base textures and add them to the decal.

 

Of course, if there were some programmatic way to stretch a bias decal over arbitrary geometry and convert it to

discrete texture scaling values for each surface so that you've got something like:

 

map /bias_texture

scale parm1, parm2

shear parm3, parm4

 

and the parm values reorient the bias texture as if it were spanning multiple surfaces, that would be a true replacement for vertex painting

and could also be used for lightmapping (etc).

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

  1. Interesting stuff.
  2. Not to be a "Debbie Downer" but it seems that this takes almost as much work as making your own custom texture with the blend.
  3. Also, if I'm not mistaken, you can already mix diffuse stages with a bias image and the "add" keyword:
  1. Thanks.
  2. Once you have the program writing the material only takes you 5 minutes, if even. I fairly doubt you can create textures that fast. Also, you would blow up the space needed by addding more and more textures. And if you have several variations of how you blend two textures, custom textures for each variation would require more graphics memory and would therefore be more performance-houngry.
  3. Funnely, this was the first thing I've tried. However, the add keyword does not seem to work. Using it gives you a warning message and a black texture :( Do we have any instance, probably in the stock doom 3 materials, where this keyword is actually used. Maybe it was just planned and never implemented.

This is the warning you get when using add

WARNING:Couldn't load image: add( add( textures/darkmod/stone/brick/blocks_brow
n, textures/darkmod/decals/dirt/dripping_slime05), add( textures/darkmod/nature
/grass/grass4, invertColor( textures/darkmod/decals/dirt/dripping_slime05)))
 
WARNING:Couldn't load image: add( textures/darkmod/stone/brick/blocks_brown, te
xtures/darkmod/decals/dirt/dripping_slime05)

The second one is when I only try to use it for two textures.

 

However, even if it would work, as far as I understand the documentation the add keyword was meant to be additive, not multiplikative. (As the name already implies ;) )

  • Like 1

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 comment
Share on other sites

Hmm, yeah the additive nature of the keyword will be an issue there I guess,

 

I suppose you might be able to do this instead:

 

diffusemap

map _white

 

blend filter

 

map add(texture_1, bias_texture) // bias texture uses white to mask rather than black

 

blend filter

map add(texture_2, invertColor(bias_texture))

 

I'll test this one tonight if I get a chance.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

You've overread the important part, add doesn't work at all. ;)

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 comment
Share on other sites

Even a basic add operation like:

 

diffusemap

map add(textures/darkmod/stone/brick/blocks_brown, textures/darkmod/decals/dirt/dripping_slime05)

 

?

 

I thought the failure might be due to nesting syntax

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Nope, see second warning in post 337.

 

However, the shader is written, using your approach instead wouldn't make it easier anyways. No need to do a lot of digging imho.

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 comment
Share on other sites

Argh! I think I know why "add" doesn't work...

 

It seems that image programs don't work on compressed DDS images...

 

Edit:

 

Confirmed. The "add" image program only works with uncompressed textures.

 

Edit 2: (just because of my OCD) Yes, this works with tga:

 

textures/add_two_nbohr1more
{

   {
     blend diffusemap
	 map _white
    }
	
     {
      blend filter 
      map add(textures/conny.tga, textures/bias_map.tga)
     }
     {
      blend filter
      map add(textures/cuckold.tga, invertColor(textures/bias_map.tga))
     }
}

Edit 3:

 

This works to blend the normal maps:

 

        {
	 blend bumpmap

         map addnormals(
         add(
         textures/bias_map.tga, textures/darkmod/stone/brick/blocks_brown_local.tga), 
         add(
         invertColor(textures/bias_map.tga), 
         textures/darkmod/stone/cobblestones/cobblestones_rounded_brown_local.tga)
         )
	}
	

(extra spacing to make all the syntax requirements clear).

 

Full example: two poster textures crossfaded and brick crossfaded with cobblestone:

 

post-3763-0-65347100-1475723282_thumb.jpg

 

 

Now the nutzo part of this is that I tried using heightmap to convert the black and white bias texture into

a normal map but it didn't work. I then tried to use scale to make the bias texture blue only but that didn't work.

On a lark I then just added the bias texture directly to the normal map and it worked!?!?

Then the rest worked according to logic. Cool accident.

  • Like 4

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Beeing able to blend the normals is definetely an improvement. Thanks for the investigation. It might be worthwhile to check why the code doesn't accept compressed images as arguments for add and see if we can change that.

 

I guess I'll take a look and see if I get an idea of whether it would be possible. In that case I would file a bugtracker. :)

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 comment
Share on other sites

Won't a blend filter only darken a texture rather than blend them together naturally?

Link to comment
Share on other sites

Won't a blend filter only darken a texture rather than blend them together naturally?

What are you referring to?

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 comment
Share on other sites

That is what I thought too, but what is really happening is:

 

( source_texture * framebuffer ) + ( framebuffer * 0)

 

So it is only capable of darkening but it the darkening covers the full color range.

If you start with a white diffuse map, the darkening is only based on the input of how

much light strikes the white texture and thus it mimics the way that the regular diffuse

image works.

 

The problem in my diffuse example is that to crossfade the textures with blend filter I had to mask

the unwanted area with white and that masking is unnecessarily brightening the crossfade

region. I think I can correct that with one more filter stage to counteract it.

 

Probably something like:

{
blend filter

map add(add(textures/bias_map.tga, invertColor(textures/bias_map.tga)), add(invertColor(textures/conny.tga),invertColor(textures/cuckold.tga)))
}
Edit: Nope, cannot find a native way to correct the bright band. Had to create a corrective filter

texture in GIMP by flipping a duplicate layer and using darkening then inverting the whole thing:

 

post-3763-0-73466700-1475807170_thumb.jpg

 

I guess using native functions for diffuse blending is mostly only practical where you don't care about a little

brightening at the boundary.

 

 

 

Obsttorte's shader doesn't suffer that diffuse problem and it works with DDS. So use my operation for bumpmap and Obsttorte's shader

for diffuse.

  • Like 2

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

A while ago I posted an approach to trigger events, if the player was looking at something. I created a scriptobject that can be used for such an approach.

attachicon.giftrigger_look.script.txt

This scriptobject does allow an entity to trigger it's targets, if it is seen by a specified entity. The term "is seen" does only apply wordly to the player. For other entities (mainly AI) this means they must face the direction (so the z value is ignored). This is because the visibility directions function on them does not work properly. Nevermind.

 

To make it work you just need to copy the above file into your scripts directory and include it with

#include "script/trigger_look.script"
in your tdm_custom_scripts.script file. Don't forget to delete the .txt ending.

 

In DarkRadiant, if you want an object to react to for example the player looking at it, add the spawnarg "scriptobject" "trigger_look" on it. That's it. If the player is now looking at the object, it will trigger it's targets.

 

The specific behaviour of the object can be controlled by some spawnargs:

  • entityname: the name of the entity to react to (regarding the look direction) (default: player1)
  • stim: the number of the stim that activates the check (default: 23=PLAYER_STIM)
  • distance: the distance between the object to look at and the entity causing the check that should not be exceeded (default:1024)
  • tolerance: the view angle tolerance (default: 0.1), the higher this value, the less precise the entity must be looked at
  • once: if set to 1, one time use only (default: 0)
So without any spawnargs set this entity reacts to the player in a relatively high distance. If you want to use custom stims, they start with 1000 upwards.

 

EDIT: The entity only checks if it is looked at. The real visibility, so if something is in the view between the entity and the viewer, is not checked. Use the distance spawnarg to bypass negative side-effects through this behaviour. If someone needs a version that checks visibility, to, just post here and I will create one. (The same accounts for other stuff may needed).

 

 

 

I tried this and got an error: "missing "AI_DEAD" field in script object trigger_look.script" or something to that effect. Does that mean anything to you?

 

(a few more details...put the "scriptobject" spawnarg on an AI, and then targetted him at a gui_message entity I want to play when the player looks at the AI, but loading the map crashes with the above error)

Link to comment
Share on other sites

Can you pack up an example and pm it to me so I can take a look? It's hard to tell from the distance.

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 comment
Share on other sites

Can you pack up an example and pm it to me so I can take a look? It's hard to tell from the distance.

 

Try this. It's supposed to trigger the light when you turn to look at the AI, but for me it just crashes on load with a "missing "AI_DEAD" field in script object trigger_look.script" error.

 

http://www.mindplaces.com/look_script.pk4

Link to comment
Share on other sites

Ah, you've used it as a scriptobject for the ai. Well, this wont work. The ai already uses a scriptobject, and if you replace it, it wont use the old one and will therefore not work.

 

If you want a reaction when looking at an ai you have to merge the scriptobject of the ai with the trigger_look script.

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 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

    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 0 replies
    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
×
×
  • Create New...