Voxels are multicoloured

Hi! So I got the add-on to work that it voxelfies the model but I noticed that the different voxels are multicolored. I tried changing the size from 0.001 to another, but that didn't seem to work.

  • adrian replied

    Hey aartsa ,

    Can you provide a screen shot to try to establish what the issue maybe.

  • artsa replied

    Yeah here is a picture of what I'm talking about. You see the lines of the voxels and how the textures of the model are applied to them. 

  • spikeyxxx replied

    Remember you changed line 91 in the Script from percentage to ratio.... but that also changes the numbers: 5% = 0.05.

    So change the line like this:

    That should work.

  • adrian replied

    Hey aartsa ,

    There are some changes in the Blenders Python script since this course.

    From the 'voxelfy_1,1.py' script included when downloading the source files, make the following changes.


    Line 108

    currently:

    bpy.ops.object.modifier_apply(apply_as='DATA', modifier="DataTransfer")

    delete apply_as='DATA', to read:

    bpy.ops.object.modifier_apply(modifier="DataTransfer")


    Line 123

    currently:

    bpy.ops.mesh.select_random(percent=count, seed=count)

    change percent to ratio  and after count / 100:

    bpy.ops.mesh.select_random(ratio=count / 100, seed=count)


    line 123 is part of the operation to reduce each face to a single color.

    the select random operation now uses a ratio between 0 and 1 instead of a percentage between 0 and 100, so dividing by 100 will give 0.01, 0.02, 0.03 etc, etc, while looping through the count. 

    0.01 is equivalent to 1%, 0.02 = 2%, 0.03 = 3%, etc, etc.

    This should work now as intended in Blender v3.0

    Hope this helps.


    @jlampel , if you have the time, would it be worth updating the script with the source files?

  • artsa replied

    Hmmm I would say it is better, but not quite there yet still. Any other suggestions?

  • artsa replied

    I am a little confused by this answer because my code line 108 doesn't have those kinds of commands. My code looks like this.


  • adrian replied

    I have used the code from the source files

    It maybe line 67 instead of 108

    and line 90 instead of 123

    if you are using the earlier version of the script.

  • spikeyxxx replied

    @adrian2301 it is line 77 and in the .py script, it is already corrected:

  • spikeyxxx replied

    Weird, I've tested the Cheetah file and it seems to work fine:


  • adrian replied

    There are a few version floating about on my drive.

    I suppose I should clean up a bit.

  • spikeyxxx replied

    Just wondering...

    I tried changing the size from 0.001 to another

    did you change that back?

  • artsa replied

    Yes I have, it is 0.001 at the moment

  • spikeyxxx replied

    And did you test it on the Cheetah file like above?

  • artsa replied

    Well I've been testing this with my own model, but now I tested it with the cheetah model as well, and the same results appeared.

  • spikeyxxx replied

    Well, the only two things I can think of then, are:

    1. there still is a mistake in the .py file you have. Try it with: https://drive.google.com/file/d/19eUwTFLOB9d2wen5u7BBwrMqwffRjkJb/view?usp=sharing  

    2. there is something wrong with your graphics card driver (make sure to update to latest).

    3. something else

  • adrian replied

    Works for me too!

  • Jonathan Lampel replied

    Thanks for troubleshooting this spikeyxxx ! I noticed that the download for the course was an older version and didn't include all the fixes, but that's been updated. 

  • artsa replied

    Yeah now it works even for me. Thanks everyone who tried to help me in various ways! Appreciate it :)