Comments (6)
@axredneck : I was thinking of a python callback ran just before update object uniform of the custom shader. But it's only for custom shader not for blender material.
Else material switch will be targeted in 0.1.1.
from upbge.
@sdfgeoff: I don't know if changing material during runtime can be easy to implement... I think this is like light.type (we can't change it without to have to recompile the shader... But maybe Tristan has a better idea about that.
But what we could do is a function that copy all other material properties and apply it to our material.
- Copy a material properties and assign it to our material can already be done (for the most part) with new KX_BlenderMaterial API:
KX_PYATTRIBUTE_RW_FUNCTION("alpha", KX_BlenderMaterial, pyattr_get_alpha, pyattr_set_alpha),
KX_PYATTRIBUTE_RW_FUNCTION("hardness", KX_BlenderMaterial, pyattr_get_hardness, pyattr_set_hardness),
KX_PYATTRIBUTE_RW_FUNCTION("specularIntensity", KX_BlenderMaterial, pyattr_get_specular_intensity, pyattr_set_specular_intensity),
KX_PYATTRIBUTE_RW_FUNCTION("specularColor", KX_BlenderMaterial, pyattr_get_specular_color, pyattr_set_specular_color),
KX_PYATTRIBUTE_RW_FUNCTION("diffuseIntensity", KX_BlenderMaterial, pyattr_get_diffuse_intensity, pyattr_set_diffuse_intensity),
KX_PYATTRIBUTE_RW_FUNCTION("diffuseColor", KX_BlenderMaterial, pyattr_get_diffuse_color, pyattr_set_diffuse_color),
KX_PYATTRIBUTE_RW_FUNCTION("emit", KX_BlenderMaterial, pyattr_get_emit, pyattr_set_emit),
RW means read and write.
- For shadows in custom shaders, you can have a look here: http://blenderartists.org/forum/showthread.php?390765-Custom-GLSL-Materials-with-Shadows
from upbge.
@sdfgeoff : So you want to replace material for a RAS_MeshObject not per game object : RAS_MeshSlot ?
If yes i propose the following API:
KX_MeshProxy.replaceMaterial(matid, KX_BlenderMaterial)
But here we will get some trouble because there's no way to find a KX_BlenderMaterial other than found it in a mesh, so if we replace it, it's lost the the material.....
The solution shoudl be to expose a list of all material in a python proxy for the KX_BlenderSceneConverter.
from upbge.
Well I believe materials are associated with meshes, or at least, a texture slot in a mesh. As such it makes sense for the operation to be on a mesh.
If you replace it it's lost. That's fine by me.
from upbge.
Is it possible to implement tweaking the same material by passing some per-object "uniforms" to the shader, like "Object Color" already does? I know it's not exactly "switching of materials" but it can serve the same purpose, especially if passing these "uniforms" to node material.
edit: Excuse me for proposing yet another "feature request".
from upbge.
from upbge.
Related Issues (20)
- 0.3+: Mouselook bug HOT 1
- Flatpak/Snap releases? HOT 3
- 0.3+: blenderplayer leaks reported from 6 to 8 HOT 1
- 0.3+: Parent/children replication remapping issue
- Component scripts freezing and not updating HOT 2
- 4.1: `sensor.link(controller)` and `controller.link(actuator)` seem to cause an access violation HOT 3
- UPBGE 0.3 cant go back to Previous scene
- UPBGE crashes when moving UPBGE window while game plays
- Cannot change theme of Logic Bricks Editor HOT 1
- UPBGE crashes when python script has syntax error
- UPBGE 0.4.1: instances of Collections that use "LOD"cause crash.
- development idea : build ubpge around bforartists
- Wayland Flickering UI HOT 1
- Viewport "Zoom In" using Embedded Start
- AliceLG Aden (Lookingglass for Blender)
- Suddenly Shadows Disappear, then the whole frame becomes white. HOT 1
- Feature Request: Windows MSI
- Move Depsgraph to Separate Thread
- checksum for alpha/beta development
- "use viewport render" and "sample per frame"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from upbge.