Page 2 of 2 FirstFirst 12
Results 21 to 28 of 28
  1. #21
    Originally Posted by Maujoe View Post
    @3D Upgrade Thank you, yes it's not a prank, it's real. Nice tutorials by the way, I have taken a quick look to them.


    @bright1 Sorry, I haven't seen your question. Thats's a good point I will add it to the start post in the future.

    It's not an addon, it's more like a library, your just need to copy the "custom_shaders" folder in the directory of your Projekt (Blend file) and attach the shader to your objects via Python/ -components like in the examples. If you use Python components you should call it with "shader_components.Wind".

    Things to consider:

    -The origion of the object should be on the bottom of the tree (roughly) because it will be used to determin the ground level (no wind area) you can adapt it also with the ground level setting. <-- maybe thats the reason why your trunk don't move.
    -Also the scale of the object should be applied (Objectmode -> ctrl+A -> Scale)
    -The trunk and the leaves should have the same wind settings otherwise they are out of sync (it's a limitation at the moment).

    I hope, that helps you. If you have any further questions, just ask!
    Thanks alot man, it now works fine



  2. #22
    Member the_cannibal's Avatar
    Join Date
    Aug 2015
    Location
    Germany
    Posts
    279
    is it possible to deactivate the shader in game?

    have trying to change/remove state of the python controller to deactivate it but nothing changed.
    also trying to stop the update() function via props(python) nothing?

    it would be usefull because I am trying to get a full customized scene.

    here the state version I am trying (yes not only for this shader)


    Code:
    from bge import logic, render
    import Scripts.load_settings as load_settings
    import configparser
    config = configparser.RawConfigParser()
    config.optionxform = lambda option: option
    
    scene = logic.getCurrentScene()
    obj_list = scene.objects
    class GFX():
        def __init__(self):
            self.settings_dict = {}
            self.manip_objs_list = [o for o in obj_list if 'gfx_obj' in o]
            self.weather_obj_list = [o for o in self.manip_objs_list if 'weather_obj' in o]
            self.wind_obj_list = [o for o in self.manip_objs_list if 'wind_obj' in o]
            self.moveing_obj_list = [o for o in self.manip_objs_list if 'moveing_obj' in o]
            self.particles_obj_list = [o for o in self.manip_objs_list if 'particle_obj' in o]
            self.daystart_obj_list = [o for o in self.manip_objs_list if 'day_start_obj' in o]
            self.daycycle_obj_list = [o for o in self.manip_objs_list if 'day_cycle_boj' in o]
            self.sunbeam_obj_list = [o for o in self.manip_objs_list if 'sun_beam_obj' in o]
            self.shader_obj_list = [o for o in self.manip_objs_list if 'shader_obj' in o]
            #print([o.state for o in self.wind_obj_list])
    
        def get_settings(self):
            self.settings_dict = load_settings.get_file(config)
    
        def update_settings(self):
            if self.settings_dict['wind'] == 1:
                for o in self.wind_obj_list:
                    o.state = 536870913
            else:
                for o in self.wind_obj_list:
                    o.state = 1
    
            #if self.settings_dict[''] == 1:
    
        def main(self):
            self.get_settings()
            self.update_settings()
    
    gfx = GFX()
    
    def main(cont):
        gfx.main()
    eat ... fresh
    you are on Discord? PM me!



  3. #23
    Member BluePrintRandom's Avatar
    Join Date
    Jul 2008
    Location
    NoCal Usa
    Posts
    18,331
    it seems like it's a class / component

    store it somewhere when it's created to access it again later maybe?
    Break it and remake it - Wrectified
    If you cut off a head, the hydra grows back two.
    "headless upbge"



  4. #24
    Member the_cannibal's Avatar
    Join Date
    Aug 2015
    Location
    Germany
    Posts
    279
    yes I do that.

    the problem is not the script/code I wrote more than that, the problem is by changing the state not only via script also via logic brick the wind shader is still running
    eat ... fresh
    you are on Discord? PM me!



  5. #25
    Member BluePrintRandom's Avatar
    Join Date
    Jul 2008
    Location
    NoCal Usa
    Posts
    18,331
    yeah, the class is a component, to kill it it's a matter of accessing the class somehow I think,

    so after you create the class instance, you need to store a ref to it in global dict or something, I think*
    Last edited by BluePrintRandom; 16-Sep-17 at 13:55.
    Break it and remake it - Wrectified
    If you cut off a head, the hydra grows back two.
    "headless upbge"



  6. #26
    Member the_cannibal's Avatar
    Join Date
    Aug 2015
    Location
    Germany
    Posts
    279
    you are right:

    # Create wind shader (via WindShader class) and store it in a object property.
    ob['_shader'] = WindShader(mat, texture, scale, vertex_lighting, normalmap, normal_factor)

    now I have to figure out how to pause or stop the wind_shader

    maybe with an stop update @property?
    eat ... fresh
    you are on Discord? PM me!



  7. #27
    Member the_cannibal's Avatar
    Join Date
    Aug 2015
    Location
    Germany
    Posts
    279
    sorry don't get it.

    any ideas, solutions?
    eat ... fresh
    you are on Discord? PM me!



  8. #28
    Do you just want to stop objects from moving or do you want to replace the whole wind shader with the default one?
    (A object always needs a shader otherwise it's not be visible.)

    Currently the WindShader class doesn't have a functionality to pause or reset the shader.
    So basically the WindShader class just replaces blender's build in shader with a custom shader at the initialization and hold the data and pass changes to the shader. So even if the class instance is deleted the shader keep running (I should change that but I haven't thought that it's necessary).

    So at the moment there are two ways:
    The easy way is to just set the wind strength to 0.0. so the wind shader is still running but the objects don't move anymore.

    The other way is to delete the custom shader manually:
    Code:
    mymaterial.getShader().delSource()
    but then the associated instance (her references) of the WindShader class should be deleted because then the shader doesn't exist any more and a new WindShader must be created every time the windshader should run again. (Or you add this functionality yourself inside the Windshader class as long as I haven't done it)

    Currently I don't work on the shader but when I have some time I should add this functionality maybe, to avoid such workarounds.
    Last edited by Maujoe; 17-Sep-17 at 11:38.



Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •