Page 308 of 396

Re: Ask a simple question, get a simple answer

Posted: Sun May 12, 2019 1:34 am
by vanblam
I guess I could just add another texture. My resource pack as is with out doing more optimization is around 200 MB. So I think I should be ok.

Re: Ask a simple question, get a simple answer

Posted: Sun May 12, 2019 1:46 am
by vanblam
Well I just found some textures I'm not using at all lol. Now its down to 159 MB :P

Re: Ask a simple question, get a simple answer

Posted: Sun May 12, 2019 3:07 am
by minmay
vanblam wrote: Sun May 12, 2019 1:32 am
minmay wrote: Sun May 12, 2019 1:24 am No, though again, you can try to fake it by using emissive color.
I was thinking about that, but it wont receive lighting correctly right?
The fragment will still be lit as normal, but the emissive color will be added to the fragment's color at the end. So it's somewhat unfriendly with lighting but not necessarily unusable, depending on how much emissive color you're using and how heavily you expect the model to be lit.
Remember that emissive color values can be negative; vec(0,-0.04,-0.04) will make the model appear redder without brightening it. Unfortunately, both negative and positive values will look silly when the lighting is low enough - positive values make the model appear to glow, and an emissive color of vec(0, -0.04, -0.04) will make the model's hue completely red in low lighting.

So in other words, yeah, you probably want to just use a new texture.

Re: Ask a simple question, get a simple answer

Posted: Sun May 12, 2019 3:34 am
by Isaac
vanblam wrote: Sun May 12, 2019 1:20 am Silly question, is there a way to change the tint on a materials diffuse in the definition? example: I want to add a little red to the "mine_pressure_plate" material in my own material definition with out adding a new texture, is that possible?
While imperfect, it is possible to use negative emissive color values. It comes with visual side effects, but you can decide if it's a good trade-off, and you have precise control over the color values... to balance the tint effect with the off lighting. In the video, as you'll see, the trees in the center clearing are tinted red, blue, and green. The negative values [for the most part] don't cause them to glow in the dark.
Image

The effect is better suited to simple objects rather than complex ones (like sets of trees), as the color will tint the entire object equally, everywhere.

Re: Ask a simple question, get a simple answer

Posted: Sun May 12, 2019 7:49 am
by kelly1111
Isaac: could you please share the script for this?

Re: Ask a simple question, get a simple answer

Posted: Sun May 12, 2019 9:20 am
by Isaac
kelly1111 wrote: Sun May 12, 2019 7:49 am Isaac: could you please share the script for this?
It's not really a script per se—I mean technically it is. minmay shows it above.

You just call the object's model component, and use the setEmissiveColor() function with negative values.

The values that I used for the trees are these:

Code: Select all

	forest_oak_cluster_1.model:setEmissiveColor(vec(-.025))
	forest_oak_cluster_2.model:setEmissiveColor(vec(-.01,-.005,-.05))
	forest_oak_cluster_3.model:setEmissiveColor(vec(0,0,-.01))
	forest_oak_cluster_4.model:setEmissiveColor(vec(-.025,-.01))
	forest_oak_cluster_5.model:setEmissiveColor(vec(-.01,-.025,-.06))

Re: Ask a simple question, get a simple answer

Posted: Sun May 12, 2019 10:15 am
by minmay
You can also include it directly in the component definition, which is particularly useful for minimalSaveState objects:

Code: Select all

{
	class = "Model",
	model = "mod_assets/models/env/goat_statue.fbx",
	emissiveColor = vec(0.04, -0.02, 0),
}

Re: Ask a simple question, get a simple answer

Posted: Sun May 12, 2019 11:24 am
by bongobeat
I wonder how the "onInit" hook work?
Is it triggered on every loading or just once at the first loading and never used again?

per example on this object, it spawns another object:
I'm asking, because I want to add to it minimalSavestate = true , but I don't know if it is ok for that kind of object.

(the under_lava_effects is a tile damager, who has minimal... = true, the lava_volcano_eruption_ground is a particle that stays for a few seconds)
SpoilerShow

Code: Select all

    defineObject{
      name = "lava_effects",
      components = {
        { class = "Light",
          offset = vec(0, -0.5, 0),
          range = 6,
          color = vec(2.8, 1.2, 0.7),
          brightness = 10,
          castShadow = true,
          shadowMapSize = 64,
          staticShadows = true,
          staticShadowDistance = 0,   -- use static shadows always
        },
        { class = "Particle",
          particleSystem = "lava_effects",
          offset = vec(0, -0.4, 0),
        },
        {
          class = "TileDamager",
          attackPower = 3,
          damageType = "fire",
          repeatCount = math.huge,
          repeatDelay = 1,
          onInit = function(self)
            if self.go.map:getElevation(self.go.x, self.go.y) < self.go.elevation then
              spawn("under_lava_effects", self.go.level, self.go.x, self.go.y, self.go.facing, self.go.elevation-1)
            end
          end,
        },
        { class = "Timer",
          timerInterval = 1,
		currentLevelOnly = true,
          triggerOnStart = true,
          onActivate = function(self)
    for f = 0,3 do spawn("eruption", self.go.level, self.go.x, self.go.y, f, self.go.elevation) end
            self.go:playSound("magma_explosion")
            spawn("lava_volcano_eruption_ground", self.go.level, self.go.x, self.go.y, self.go.facing, self.go.elevation-1)
            self:setTimerInterval(300*(0.1+0.9*math.random()))
          end,
          onInit = function(self)
            self:setTimerInterval(300*math.random())
          end,
        },
        { class = "Sound",
          sound = "fire_pit",
          volume = 0.5,
        },
      },
      placement = "floor",
      editorIcon = 88,
    }

Re: Ask a simple question, get a simple answer

Posted: Sun May 12, 2019 6:19 pm
by minmay
If the object has minimalSaveState then component onInit hooks will run every time the game is loaded, otherwise they will only run once.

Re: Ask a simple question, get a simple answer

Posted: Sun May 12, 2019 9:45 pm
by bongobeat
ok, thanks!

so it's not a good idea to add on this object.