Jump to content

Blending textures


RafaMv

Recommended Posts

Hey guys, I was wondering is there a way to use 2 textures on the rendering? Let's say that I have a mob and I would like to use one texture for the body and another texture for the head. I tried everything, but the first texture is always replaced by the other one...

Link to comment
Share on other sites

I have done up to 8 texture blends for terrain generation

it is not something that i would recommend trying to implement into minecraft

 

in case you want to try

to do it you would have to add custom block rendering

then add cgi pixel shading (including a cgi pixel shader program)

 

if you havnt done any pixel shading before i would recommend getting used to using it in a standalone enviroment  (google LWJDL  they have some good tutorials to get you started and its what minecraft uses)

Link to comment
Share on other sites

Hi

 

So you don't actually want texture blending, you just want different textures for the different parts of the model?

 

Based on my work with blocks, you can switch textures if you make sure you flush the Tessellator in between switching.  Most of the rendering code just queues up commands on the Tessellator, so if you do this code:

 

1) change texture using GL11.bindTexture

2) do Tessellator commands

3) change texture using GL11.bindTexture

4) do more Tessellator commands

5) flush Tessellator (to OpenGL)

 

the actual order that the OpenGL sees is

1) change texture using GL11.bindTexture

3) change texture using GL11.bindTexture

5) flush Tessellator commands (2) and (4)(to OpenGL)

 

Whether this applies to you or not depends on what you're rendering.  Could you show your code?

 

-TGG

 

Link to comment
Share on other sites

Thanks for all your responses guys, but I have to rethink what is my goal.

 

Actually, what I would like to make is: a mob that can change colors depending on a float value of the entity class. therefore, I would get this value and change the color of the secondary texture using glColor4f, but i would keep the primary texture unchanged. Just imagine a dog that have spots, for instance. To be honestly, I could do lots of different textures for each mob, but it would be a pain...

Link to comment
Share on other sites

if you want to create a simple blend of, for instance fur and spots, you could do this

create each texture , fur and spots

leave fur completely opaque

but make the spots texture so only the spots show , the rest transparent

then render 2 layers

render the fur first, then render the spots a fraction above the fur

 

if you use mpc and de-compile minecraft , you could look at how the horses are done, you might get another idea from that

 

Link to comment
Share on other sites

Look into EntityHorse. It is already doing a base-color + markings combo like you are describing. Imitate and adapt.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.